开发者

Prevent a looping script from stopping when aborting the page?

I've built a looping script that i want to keep it running in the background.

The issue is that when i run it via the browser, it works fine but once i stop loading the page, the script stops/exists, i know that's pretty normal and makes sense, but how can i run a specific PHP script endlessly in the background?

It would be great if there is function 开发者_运维知识库in php that runs an other script but it goes on instead of waiting for it.


You are probably looking for:

  • shell_exec(..)
  • exec(..)
  • escapeshellcmd(../=)


It is possible to run your script from command line as a process in background. Look here Run php script as daemon process or look at http://pear.php.net/package/System_Daemon that could help you to make it work :)

Web server kills your script because when user going on another site, server needs to spawn new PHP process for example and close older one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜