For some reason I can’t seem to get exec() to execute php scripts in the background.
For example I have a file called test.php that reads contains the line:
exec("/usr/local/php5/bin/php proc.php >/dev/null &");
When I run this php script from the shell ($:php test.php) it works fine and calls proc.php but if I call this same script from the web (http://www.somesite.com/test.php) it dosn’t work right. It executes PHP but when I have the output sent to a log file (>log.txt instead of /dev/null) it says php found no input file!
Can anyone help me out with this? I have PHP-CGI running, its not an issue of exec being denied permission. It works calling other programs with arguments (ie: exec(“ping -c 10 www.google.com >log.txt &”) will run ping in the background and send its output to log.txt when called via HTTP).
Thanks in advance!