I have a PHP script say test.php
in linux Ubuntu, in this PHP script I use shell_exec()
to start several background processes.
When I execute php test.php
, the background processes are started as expected, but when I run php test.php &
, those several background processes are not started.
Is it not a supported way to start background processes from a background process, or is there a better to go about this?
Advertisement
Answer
Try php test.php < /dev/null &
– some Unix distributions seem to expect some input and send the process idle to background. Tested on Fedora Linux (bash) you can start php test.php &
but it isn’t executed. Check with jobs
running background process – catch from background and execute with fg
.