Page 1 of 1

shell_exec not displaying all

Posted: Fri Mar 07, 2008 6:09 am
by 316
I have a question.

Currently i am using this shell_exec(), to run a script, and getting results.

The problem is that the script runs in a loop displaying results, every second, while this function only gives me the first part of the result.

I am assumming that the function exit and does not wait to loop through until the script is finished.

The script i am running, loops forever, until the user manually terminates the script.

I want to be able to run the scrip, and get all results, every second and display them on my web page (run.php).

this is what i am using at the moment.

$output = shell_exec('cd testrig; ./processXML.php LoopSimTest.xml');

echo $output;

I am using linux.

Thank you in advanced.

Re: shell_exec not displaying all

Posted: Fri Mar 07, 2008 10:22 am
by Christopher
Not the way to use PHP. You script is essentially a daemon. Have it write the output to some sort of buffer and have PHP poll.