Run php script as daemon process

后端 未结 14 1588
-上瘾入骨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:32

    I wrote and deployed a simple php-daemon, code is online here

    https://github.com/jmullee/PhpUnixDaemon

    Features: privilege dropping, signal handling, logging

    I used it in a queue-handler (use case: trigger a lengthy operation from a web page, without making the page-generating php wait, i.e. launch an asynchronous operation) https://github.com/jmullee/PhpIPCMessageQueue

提交回复
热议问题