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. 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. 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). 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! Link to comment https://forums.phpfreaks.com/topic/183077-real-time-shell-output/#findComment-966370 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.