When I run an exec from PHP like so:
$result = exec('command');
The results from this will be stored in $result. But in my current case, my command can take a few minutes and outputs results as it is running. Is there a way I can get output while it is running? I know that the passthru method will output the results to be browser, but I actually want it directly.
You should take a look at proc_open
After making the output stream non-blocking (with
stream_set_blocking), you can read from it whenever you want without having your PHP-code blocked.-Edit-
If you use
It will run in the background and you can read the output in /path/to/file