I have a localhost webpage that o开发者_运维百科ccasionally splits out broken HTML midway through the page. This will also happen with images, (although I suspect because they are very large in size 1200x2000px)
But this normally will happen during a database while ($data=mysql_fetch_contents($arr))
loop.
Has anyone seen this before and what did you do to correct this?
It sounds like the PHP script may be timing out in the middle of execution, that is, run for longer than is allowed.
If the script is expected to run for a long time, you could try changing how long the script is allowed to run with the set_time_limit
function, or the max_execution_time
directive in php.ini
.
Finally found the answer was a buffer overflow issue.
Placing this code at the end of each while loop:
@ob_flush();
Fixed the problem.
精彩评论