我有最基本的脚本:
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
echo "parent done";
pcntl_wait($status); //Protect against Zombie children
echo "all done";
} else {
// we are the child
echo "Child finished";
}
当我运行它时,输出总是“孩子完成”。我在 lighttpd 服务器上运行它。