razta Posted November 27, 2009 Share Posted November 27, 2009 Hi, Currently I am echoing the output of a system() call after the command has terminated, is there any way for PHP to echo the output in real time rather than wait for the command to finish? Here is what I am currently using: echo '<pre>'; $scriptOutput = system($command, $retval); echo '</pre>'; Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/183077-real-time-shell-output/ Share on other sites More sharing options...
premiso Posted November 27, 2009 Share Posted November 27, 2009 You would need to use output buffering... ob_start and ob_flush. That should get you what you want. Quote Link to comment https://forums.phpfreaks.com/topic/183077-real-time-shell-output/#findComment-966263 Share on other sites More sharing options...
corbin Posted November 27, 2009 Share Posted November 27, 2009 Hrmmm, I don't think it's possible since system() returns all of the information at the same time. I don't think output buffering will make it real time, although it will make it be done right after the system() call (unless the webserver buffers, or the browser buffers). Quote Link to comment https://forums.phpfreaks.com/topic/183077-real-time-shell-output/#findComment-966275 Share on other sites More sharing options...
razta Posted November 27, 2009 Author Share Posted November 27, 2009 Thanks for the replys. I will have a look into buffering and see if that fixes my problem. Another quick question I have is would it be possible to send a command to a shell and then disconnect it from PHP? When I currently run a command my PHP page continualy loads until the command has finished, is there a way jut to send the command and not have PHP continuesly loading? Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/183077-real-time-shell-output/#findComment-966370 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.