Don't wait for the process to exit

后端 未结 7 2183
生来不讨喜
生来不讨喜 2020-12-12 03:17

I have a PHP script that is called from a cron job every minute. This script takes some info from the database and then calls another PHP script using the System function (p

7条回答
  •  佛祖请我去吃肉
    2020-12-12 03:36

    You could run them in the background:

    system('php yourscript.php &');
    

    You just have to make sure that you check on the total number of processes running. All in all, not a super elegant solution. Instead cron you could let one script run for forever, I am thinking something like this:

    
    

    Careful though. PHP is not exactly known to be used as a daemon.

提交回复
热议问题