0) { exit (0);//parent process exits}//child process becomes new session leader Posix_setsid ();//To prohibit the first sub-process to open the control terminal, need to create a second sub-process, specifically I do not know what principle $pid = Pcntl_fork (); ($pid = =-1) { exit ("Fork2 failed! \ n ");} ElseIf ($pid > 0) { exit (0);} echo "Process ID:". posix_getpid (). " \ n "; $open = True;function Sig_handler ($signo) {global $open; switch ($signo) {//Custom signal sigusr1case Sigusr1:echo" Hello, I keep running. n "; break;case Sigterm:echo" and so on the end of this cycle I close \ n "; $open = false;break;default:# code...break;}} Pcntl_signal (SIGUSR1, ' Sig_handler ');p cntl_signal (SIGTERM, ' sig_handler ');//This line of code is important so that each low-level statement is executed to check the signal, Otherwise, the process signal declare (Ticks=1) cannot be detected in an infinite loop, while ($open) { echo date (' y-m-d h:i:s '). \ n "; Sleep (1);} echo "I'm out of the box"; exit;