I have a script that builds my webpage in one string ($content) and then echo it to the user.
My script looks like this:
$time1= microtime(true);
$conten
I had the same problem in the past very similar to yours. I found that this problem can be caused by slow clients. If client fetched half of the page and then hangs, php will wait until client is ready and then sends rest of the content. So it could be not problem on your side.
You can try following scripts on your server to check this. This script put on your server and call it echo.php:
Then fetch it with this script (change example.com to your domain):
\n";
} else {
$out = "GET /echo.php HTTP/1.1\r\n";
$out .= "Host: example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 5000);
sleep(1);
}
fclose($fp);
}
I've got echo.php
running 27 seconds. When I remove line sleep(1)
, echo.php
takes only 2 seconds to run.