I have a maintenance and cache generating php script that take quite a while to complete and I got to wishing it would show where it stands on a real time basis. It already output progress log like "generation of these pages .... Done" kinda line. Problem is with PHP, you get to wait until the page (and so, the script) is complete before showing anything... so you get the whole report, but only at the end.
I did some thinking and thought that I could make the script into a shell script to be executed in the background, called with shell_exec(), outputing a text file and on the web, creating a page that refreshes every second and that would load that text file, effectively showing where the maintenance stands... but that seems like overkill to do it like this, right ?
Is there a better way to do this ? a easy way ? anyone, any insight ?
keep in mind I cannot have it use any client-side technology like JAVA.
Actually, anlene, the result i'm trying to achieve is more or less the opposite of that... I don't want to buffer the result until the end an send at that point (or not) but rather, I want the script progress to be shown like you would, say, a shell script.
Nothing PHP can do, can guarantee results in realtime, especially output buffering. Your best recourse is to use AJAX and setup a polling routine - ie; check status every half second and report it if it has changed.
I would recommend building a PHP proxy to the process, and using dojo.io.bind from dojotoolkit.org to get the job done.
circlical - hosting software development forums * blog