note 74180 rejected from function.pcntl-fork by bobby
| From: | bobby@php.net | Date: | Wed, 28 Mar 2007 21:46:49 +0000 |
| Subject: | note 74180 rejected from function.pcntl-fork by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124899@lists.php.net to get a copy of this message | ||
Note Submitter: lukasiak dot pawel at gmail dot com
----
Hello
I tried to test forking with this simple code given as a example. I have script
<?php
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
echo 'In parent';
pcntl_wait($status); //Protect against Zombie children
} else {
echo 'In child';
// we are the child
}
?>
Unfortunately, when I execute this script I have only 'In child' message on a screen. I
noticed that I always have a only message from process which ends first. Does anyone have any idea
why?