Run php script as daemon process

后端 未结 14 1471
-上瘾入骨i
-上瘾入骨i 2020-11-22 11:36

I need to run a php script as daemon process (wait for instructions and do stuff). cron job will not do it for me because actions need to be taken as soon as instruction arr

14条回答
  •  太阳男子
    2020-11-22 12:23

    You could start your php script from the command line (i.e. bash) by using

    nohup php myscript.php &

    the & puts your process in the background.

    Edit:
    Yes, there are some drawbacks, but not possible to control? That's just wrong.
    A simple kill processid will stop it. And it's still the best and simplest solution.

提交回复
热议问题