IIS 7.5 使用 PHP 存在性能问题

4
为了测试目的,在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";

(脚本来自此处:https://serverfault.com/questions/192211/iis-logging-write-to-log-file-more-often) 执行时间为:0.00002秒。
我在本地的Web服务器IIS7.5上运行。 我也使用Chrome浏览器。
加载页面需要1秒钟。您有什么想法为什么会需要这么长时间?我期望它应该立即响应。 敬礼, 保罗
1个回答

2

除非你将PHP运行为fastCGI模块,否则IIS需要从头启动一个PHP进程,即:加载可执行文件、解析配置、加载扩展等等会导致延迟。另一方面,fastCGI保持X个进程并准备好处理请求。

这里有有关fastCGI设置的文档


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接