Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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
}

?>

Documentation

See Also