Large maintenance php script. How to print debug string while the script is executing?
I have a very large php maintenance script (basically it recreates thumbnails for an internal archive), it takes 10 to 20 minutes to complete and I noticed that php only displays "echos" when the whole script has finished parsing. Is there any way to show messages like:
Phase 1 - Comple开发者_运维问答te
Phase 2 - Complete
Phase n - Complete
While the script is still doing his thing?
Thank you very much
You probably want to flush the output.
Use flush()
( http://docs.php.net/flush ), but be aware that your web server may be buffering output. If so, you will have to turn it off or set the buffer very low to get output as it happens.
Or maybe turn of the output buffering in php.ini: output_buffering = Off
精彩评论