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. Quote 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. Quote 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. Quote 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. Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/247305-shell_exec-output-buffer/#findComment-1270126 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.