Process Control (pcntl)¶
Process Control is a set of native PHP function, that handles signals coming from the OS.
pcntl
is suited for CLI operations, and not for web serving operations.
pcntl
manage process creation, program execution, signal handling and process termination.
<?php
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
pcntl_wait($status); //Protect against Zombie children
} else {
// we are the child
}
?>
See also Example: Parallel processing in PHP using pcntl_fork()
Related : PHP Handlers, Shell, System Event