了XDebug - PHP脚本随时间服用5到30秒最后一行
问题描述:
后结束,我有一些脚本运行呈现出的网站,并在我的MacBook,安装PHP 7.1 + Xdebug的,如果我不把出口在年底的脚本,PHP需要很长时间才能完成执行。了XDebug - PHP脚本随时间服用5到30秒最后一行
此代码正常工作:
<?php
$start = microtime(true);
// many many code
exit(microtime(true) - $start);
// exits 0.2
此代码结尾非常缓慢:
<?php
// many many code
echo microtime(true) - $start; // echoes 0.2s
// but the script need about 10.4s to finish (quite long and changing time)
我没有任何代码退出后,所以这真的是我的脚本结束。 ..
这是不会发生的是Windows还是在Linux上。我的设置有什么问题?
答
我设法通过禁用的XDebug远程解决我的问题,感谢@马里奥的评论:XDebug的是为远程使用启用。禁用它使我的脚本再次快速结束:
xdebug.remote_enable = 0
xdebug.remote_autostart = 0
您需要展示更多代码才能确定发生了什么事情。 –
即使退出后没有代码? –
你确定退出后没有代码吗?你确定这个文件没有被执行,因为包含在另一个文件中,在这个文件中可能有更多的代码? – ksjohn