Hi, I have a php file that is trying to run a second php file as a background process using the exec() function. The second file is a php script that will run the ffmpeg video encoder and update the database when the encoding is complete. My problem is I can't get this second sript to run.
What appears to happen is the first php file with the code below just loops and runs over and over. I tested this by having it write to a text file every time it runs, and it just keeps looping forever writing to the log text file. The second php file never gets called as far as I can tell.
I've tried system() and shell_exec() instead of exec() and get the same results.
Also, if I run exec($command) without sending it to the background, the browser will hang, and the server will eventually crash.
When I add the optional $output and $return_var arguments to the exec() command, output is an empty Array() and return_var = 0.
Running on Linux dedicated server running Centos 4.7
$command = "/usr/bin/php -f /home/USERNAME/public_html/encoder.php";
exec ($command . " > /dev/null &");