bayesianmind
asked on
Running system commands unbuffered in PHP or Perl
I am looking for a way to run call an external system command and capture the output to display to the browser in real time. This external script runs for a long time (2 mins or so) so it would be great if there was a way for this output to come to the browser in semi realtime.
The script I'm running is a perl script, so alternatively the script could to display output could be in perl.
I'm running Linux and Apache.
Thanks in advance.
The script I'm running is a perl script, so alternatively the script could to display output could be in perl.
I'm running Linux and Apache.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Perhaps the proc_open function in PHP may do this?
http://au.php.net/manual/en/function.proc-open.php
Unfortunately, I do not have any experience with this function. Or even know if it will stream the data for you?
Sorry that I can't give you a definitive answer. But good luck and I'm keen to hear if you find a solution :)
http://au.php.net/manual/en/function.proc-open.php
Unfortunately, I do not have any experience with this function. Or even know if it will stream the data for you?
Sorry that I can't give you a definitive answer. But good luck and I'm keen to hear if you find a solution :)
ASKER
I found the answer on one of the php doc pages.
You just have to set:
ob_implicit_flush(true);
ob_end_flush();
at the beginning of the php.
Thanks for the help!
You just have to set:
ob_implicit_flush(true);
ob_end_flush();
at the beginning of the php.
Thanks for the help!
ASKER