note 74180 added to function.pcntl-fork
| From: | lukasiak dot pawel at gmail dot com | Date: | Wed, 28 Mar 2007 21:41:09 +0000 |
| Subject: | note 74180 added to function.pcntl-fork | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124898@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 69.147.83.197
Probable Submitter: 90.156.5.3
----
Manual Page -- http://www.php.net/manual/en/function.pcntl-fork.php
Edit -- https://master.php.net/note/edit/74180
Del: integrated -- https://master.php.net/note/delete/74180/integrated
Del: useless -- https://master.php.net/note/delete/74180/useless
Del: bad code -- https://master.php.net/note/delete/74180/bad+code
Del: spam -- https://master.php.net/note/delete/74180/spam
Del: non-english -- https://master.php.net/note/delete/74180/non-english
Del: in docs -- https://master.php.net/note/delete/74180/in+docs
Del: other reasons-- https://master.php.net/note/delete/74180
Reject -- https://master.php.net/note/reject/74180
Search -- https://master.php.net/manage/user-notes.php