Re: PHP output while script is running
I have a PHP script that has to cycle through XML feeds containing hundreds of thousands of elements once a month. I use the same basic methodology you are looking for where it outputs a '.' each time it processes an XML element so I know the script hasn't died. The basic code is the following:
echo '. ';
if ($a % 10 == 0) {
ob_flush();
flush();
}
You can remove the if and closing brace lines so it will force output to the browser after each individual '.'. In my case, outputing the dots in groups of ten is sufficient.
In my case, AJAX calls wouldn't work because the script needs to also be executed by the operating system and by wget and cron.
__________________
The best way to learn anything, is to question everything.
|