I have a PHP script that keeps running in the background endlessly. It also keeps flush()ing debug messages. Is there a way to display those flushed messages within another HTML page?
+1
A:
Redirect the output from the background script to some file, and display that file in the HTML page using readfile() or similar? If you're printing to stdout from the background script, it's going somewhere. Maybe somewhere useful (a file), maybe somewhere useless (your terminal, or /dev/null).
Adam Backstrom
2010-05-10 18:03:05
Interesting, can it be displayed in HTML in real time?
gAMBOOKa
2010-05-10 18:11:01
Well if you're continually flushing, the file will always be receiving new data. If your "HTML page" is just another PHP script, this PHP script can read that log file like it would any other file on disk, so yes, it would be displayed in real time.
Adam Backstrom
2010-05-10 18:19:47