Reputation: 25435
For testing purposes I have the following script in PHP 5.4:
define(START_TIME_CUSTOM, microtime(true));
function onEndTimeCompute() {
$timeTaken = microtime(true) - START_TIME_CUSTOM;
echo "Completed In: ".number_format($timeTaken, 4)." Seconds\n";
}
register_shutdown_function('onEndTimeCompute');
echo "Just before exit";
exit;
echo "Just after exit";
(Script taken from here: https://serverfault.com/questions/192211/iis-logging-write-to-log-file-more-often) The execute time is: 0.00002 seconds.
I'm running on a local webserver IIS7.5.
I'm also using Chrome.
It takes 1 second to load the page. Any ideas on why it takes a full second? I'd expect it to serve the response instantly.
Regards, Paul
Upvotes: 4
Views: 6671
Reputation: 32232
Unless you're running PHP as a fastCGI module the lag time is like because IIS has to fire up a PHP process from scratch, ie: load the executable, parse the config, load extensions, etc. On the other hand fCGI keeps X processes up and ready to handle requests as soon as they come in.
There's documentation on fCGI setup here.
Upvotes: 2