pcntl_fork(3) php man page | unix.com

Man Page: pcntl_fork

Operating Environment: php

Section: 3

PCNTL_FORK(3)								 1							     PCNTL_FORK(3)

pcntl_fork - Forks the currently running process

SYNOPSIS
int pcntl_fork (void )
DESCRIPTION
The pcntl_fork(3) function creates a child process that differs from the parent process only in its PID and PPID. Please see your system's fork(2) man page for specific details as to how fork works on your system.
RETURN VALUES
On success, the PID of the child process is returned in the parent's thread of execution, and a 0 is returned in the child's thread of execution. On failure, a -1 will be returned in the parent's context, no child process will be created, and a PHP error is raised.
EXAMPLES
Example #1 pcntl_fork(3) example <?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
pcntl_waitpid(3), pcntl_signal(3), setproctitle(3). PHP Documentation Group PCNTL_FORK(3)
Related Man Pages
pthread_atfork(3) - debian
fork(2) - ultrix
fork(2) - opendarwin
fork(2) - netbsd
pcntl_fork(3) - php
Similar Topics in the Unix Linux Community
fork()ing hell!!
about child process
Can a batch job truly have a PID of 1?
help with unix command exec1 in C
Fail Parent Script if any of the child fails