The Little Guy Posted September 16, 2011 Share Posted September 16, 2011 I am using shell_exec, and it runs a ping on a server, is there any way to flush the buffer of the shell_exec as the data is getting written to the buffer? Because I sometimes ping a site 10 times and nothing get written until the function finishes, so is there anyway to write out the output as soon as it is available? btw, this isn't only for doing a ping it is for other things as well. Link to comment https://forums.phpfreaks.com/topic/247305-shell_exec-output-buffer/ Share on other sites More sharing options...
trq Posted September 16, 2011 Share Posted September 16, 2011 Are you planning on accessing this script from a browser? HTTP doesn't work like that. Link to comment https://forums.phpfreaks.com/topic/247305-shell_exec-output-buffer/#findComment-1270118 Share on other sites More sharing options...
The Little Guy Posted September 16, 2011 Author Share Posted September 16, 2011 Are you planning on accessing this script from a browser? HTTP doesn't work like that. Nope, from a cli. Link to comment https://forums.phpfreaks.com/topic/247305-shell_exec-output-buffer/#findComment-1270122 Share on other sites More sharing options...
trq Posted September 16, 2011 Share Posted September 16, 2011 Use passthru instead of shell_exec. Link to comment https://forums.phpfreaks.com/topic/247305-shell_exec-output-buffer/#findComment-1270124 Share on other sites More sharing options...
The Little Guy Posted September 16, 2011 Author Share Posted September 16, 2011 Wonderful! Works like a charm! Thank you! Link to comment https://forums.phpfreaks.com/topic/247305-shell_exec-output-buffer/#findComment-1270126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.