I've seen PHP reading shell_exec live output and PHP: Outputting the system / Shell_exec command output in web browser, but can't get the following working.
NB: originally, my shell script was running some python, but I have simplified it.
live.sh
uname -a date watch --no-title date live.php
<?php $cmd = "sh live.sh"; while (@ ob_end_flush()); // end all output buffers if any $proc = popen($cmd, 'r'); echo '<pre>'; while (!feof($proc)) { echo fread($proc, 4096); @ flush(); } echo '</pre>'; ?> The uname and date outputs appear in the browser okay, but the watch output does not.
Am I in fact attempting the impossible?
python -u /path/to/watch ...orPYTHONUNBUFFERED=1 watch ...