I have this shell program that I want to execute by php. The problem is that it can potentially take a long time, and as of that I need it to have real-time updating to the user's browser.
I read that I may need to use popen() to do that, but I am sort of (ok, I really am :P) a PHP noob and can't figure out how I may be able to do it.
Would appreciate any help!
there are two possible behaviors:
Non Block, where you need to do something else between flushs (@GameBit show how to do it).
With Block, where you wait until the called command finish, in this case look passthru function
I used this solution. It works fine for me.
try this code (tested on Windows machine + wamp server)
there is a dirty easy option
redirecting the stdout to the stderr.