very slow sites
I have a server running PHP5 on IIS 6.0 (win 2003) - the sites has become very slow lately when shown by their external address (internet address) - taking up to several seconds before they show up on the browser, while loading VERY fast when I view them locally on the server. Is there anything in the PHP configuration that might cause this? Or should I keep on looking for network issues? tips would be appreciated.
Unlikely it's a php problem unless its something self provoked in the code. You could rule out php very quickly by saving the html output of a php script to a htm file, and then seeing if that loads much faster.
That would leave you mostly with the network and the webserver. Try pinging and theres some dns speed test kinda tools on the web you can try. It could be a bandwidth bottleneck too, although you would probably blatantly notice the difference in speed around peak traffic time.
Thanx for the tips.
I tried to put the php output to a plain html and its VERY fast even through the Internet. Sounds like a PHP problem doesn't? or perhaps MySQL. Again this is not the case when browsing internal - ONLY external.
You need some kind of measurement to figure out what's wrong. Try to start by putting a basic timer in to your php-script and print the result out at the bottom of the page. That'll tell you if it's the script that takes long, or if it happens beforehand. Eg. at the top of your page put this:
And at the bottom of your page, put this:
$GLOBALS['time_start'] = microtime(true);
print "<p>Page rendered in " . number_format((microtime(true) - $GLOBALS['time_start']) * 1000, 4) . " ms</p>";
Thanks for the tip - this is what I got:
Originally Posted by kyberfabrikken
"Page rendered in 31.6060 ms"
And the page showed up in the browser first after 4-5 seconds.
It is very puzzling:
1. PHP are rendered fast no matter where I browse from (internal or external)
2. PHP pages show up on the browser slow when browsing externally fast when browsed internally
3. Plain HTML show up on the browser fast when browsed externally