PHP script won't run in the background

一笑奈何 提交于 2019-12-01 19:41:57

If readline is enabled in your build of php, simply pass /dev/null as the input.

In your example above, it would be:

php -f test.php </dev/null >test.log 2>&1

This is resolved now -- thanks to all who responded. The problem was that Apple provide PHP pre-built with the OS - the CLI version was built with readline included - http://www.php.net/manual/en/intro.readline.php ... this prevents any background running of scripts because readline automatically starts IO with the TTY ...

My problem was that I couldn't build my own version of PHP because of this -> http://forums.macrumors.com/showthread.php?t=1284479 - once I got that resolved my background script issue was gone :)

Well, a PHP script stops when its done execution, ie a simple echo "Hello World" is done execution as soon as it outputted the string, i would guess it have something to do with it ;-)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!