Can a PHP script start another PHP script and exit?

前端 未结 6 1921
长发绾君心
长发绾君心 2021-02-04 17:02

How can a PHP script start another PHP script, and then exit, leaving the other script running?

Also, is there any way for the 2nd script to inform the PHP script when i

6条回答
  •  时光取名叫无心
    2021-02-04 17:38

    Here's a shot in the dark: you could try using php's OS execution functions with &.

    exec("./somescript.php &");
    

    Additionally, if that doesn't work, you can try

    exec("nohup ./somescript.php &");
    

    Edit: nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.

提交回复
热议问题