Code: Select all
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
pcntl_wait($status,WNOHANG);
$fp = fopen("tmp","a");
fwrite($fp,"parent");
fclose($fp);
echo " back to parent ";
} else {
$fp = fopen("tmp","a");
fwrite($fp,"sun ");
fclose($fp);
echo " sun ";
}
on the screen i get only "sun"
and on the tmp file i get "sun parent"
how can i get the parent to continue output?
thanks