我有一个问题,我使用pcntl_fork来分叉PHP中的进程,
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
pcntl_wait($status); //Protect against Zombie children
} else {
pcntl_exec("/path/to/php/script");
echo "Could not Execute...";
}
Run Code Online (Sandbox Code Playgroud)
我试图找出一种方法来监视在父fork中作为Child执行的PHP脚本的状态.有没有什么办法可以让我们知道孩子是否还在运行,或者在执行子脚本期间是否有任何致命错误,以及从子进程到父进程的所有消息使用;
pcntl_signal(SIGUSR1, "signal_handler");
Run Code Online (Sandbox Code Playgroud)
谢谢和问候,
Arun Shanker Prasad.