i run this code on lighttp server (on centos):
[php]
$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 ";
}
[/php]
the output on the browser is “sun”
and the file content is “sun parent”
My question is how can i get the output back to the parent process?
thanks