shell_exec not displaying all

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
316
Forum Newbie
Posts: 2
Joined: Fri Mar 07, 2008 6:06 am

shell_exec not displaying all

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: shell_exec not displaying all

Post 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.
(#10850)
Post Reply