I have a PHP webpage, that generates statistics and takes about 15sec to generate them, before sending them to the Browser.
The issue I have is that the browser ends up loading with a blank page. Unfortunately I don’t have access to the error_log file.
But I figured, that if I start sending data in the foreach-loop which consumes most of the generation time like so
echo ' ';
the connection will not terminate and the page will load.
First I thought this might be a memory_limit or max_execution_time issue, so I increased both, without any luck. But this would also seam odd to me since hitting the max_execution_time would result in a blank page no matter I’m sending echo ' ' or not.
Is there an other PHP setting, I don’t know of, that would cause a connection to terminate after about 10sec without data beeing send?
Edit:
The page is not completely blank. Here is the data beeing sent:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="author" content="Gerd Grützmacher">
<meta name="robots" content="index,follow">
<meta http-equiv="Language" content="de">
<link rel="icon" href="/favicon.png" type="image/png">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!--[if (gte IE 5.9)]><!-->
<link rel="stylesheet" type="text/css" href="css/gruppenunterkuenfte-min.css" />
<!--<![endif]-->
<!--[if IE 6]>
<style type="text/css" media="screen, projection">
@import url(css/ie6.css);
</style>
<![endif]-->
<!--[if gte IE 5.9]><!-->
<script type="text/javascript" src="scripts.js"></script>
<!--<![endif]-->
After this point the statistics are beeing generated and therefore I only see a blank page.
Here is the HTTP-Header:
quest URL:http://gruppenunterkuenfte.de/index.php?mod=home&action=stats_belegungsanfrage2
Request Method:GET
Status Code:200 OK
Request Headers
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Cache-Control:max-age=0
Referer:http://gruppenunterkuenfte.de/index.php?mod=home&action=stats_belegungsanfrage2
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Query String Parameters
mod:home
action:stats_belegungsanfrage2
Response Headers
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Type:text/html; charset=utf-8
Date:Sat, 25 Sep 2010 15:07:11 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:Apache/2.2.16
Transfer-Encoding:chunked
X-Powered-By:PHP/5.2.11
Here are my 2 cents:
First off i would make sure that all types of buffering is off. A gentleman was kinda enough to provide this code once:
After that i would suggest that you send an
echo ' ';after some intervals. For instance if your code has a loop, send an echo after lets say every 10th iteration or something like that, based on how long each iteration takes. That way you aren’t wasting time sending echos and you page stays alive as well.