Cap*_*Wiz 14 php windows xampp xdebug
PHP在我的Windows桌面上运行得太慢,phpMyAdmin需要几分钟才能打开数据库.以下是运行简单PHP测试程序的时间比较:
这是测试程序......
<?php
$rStartTime = microtime(true);
$countTo = 100000;
$a = 0;
//$countTo = $countTo * 100;
for ($x = 0; $x <= $countTo; $x++) {
    $a = sqrt(pow($x, 2));
}
$rMs = floor((microtime(true) - $rStartTime) * 1000);
echo 'timer done, countTo=' . $a . ' ms=' . $rMs;
通过在Firefox中输入" http://localhost/timer.php " ,可以在不进行调试的情况下运行测试程序.
本地机器通常很快.它正在运行......
是什么让PHP运行得如此之慢?
Cap*_*Wiz 21
我在xampp\php\php.ini中发现问题是Xdebug.以下是尝试在网络上找到的许多解决方案的结果:
以管理员身份运行XAMPP 并重启服务器: 3617毫秒
在xampp/apache/conf/httpd.conf中,将localhost替换为127.0.0.1并重新启动服务器: 3639 ms
在Windows/System32/drivers/etc/hosts中,添加"127.0.0.1 127.0.0.1"和"127.0.0.1 localhost"并重新启动Windows: 3960 ms
在Windows/System32/drivers/etc/hosts中,取消注释"127.0.0.1 localhost"并重新启动Windows: 3659 ms
在php.ini中,取消注释zend_extension ="C:\ xampp\php\ext\php_ eaccelerator _ts.dll"并重新启动服务器: 3643 ms
在php.ini中,设置xdebug.remote_enable = 0: 3598毫秒
在php.ini中,设置remote_host =" localhost ": 3593 ms
在php.ini中,设置xdebug.profiler_enable = 0: 249毫秒
在php.ini中,注释掉所有Xdebug语句: 27 ms - 成功!
可悲的是,我犯了错误,需要Xdebug :-(
我使用xdebug idekey设置解决了我的问题(xdebug.idekey ="xdebug1")和chrome扩展xdebug帮助器(https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc)
*别忘了禁用remote_autostart(xdebug.remote_autostart = 0)
只能通过请求激活debug(xdebug),使用idekey设置,所以如果不需要调试,php处理可以更快/更正常,通过chrome扩展按钮
我在Windows 10 64bit上使用xampp 1.8.3,我使用自定义idekey,xdebug.idekey ="xdebug1",与xdebug helper设置相同
[XDebug]
zend_extension = "E:\xampp183\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "E:\xampp183\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_autostart=0
xdebug.idekey="xdebug1"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "E:\xampp183\tmp"
xdebug.remote_log="E:\xampp183\tmp\xdebug\xdebug.log"
现在断点/调试仅在通过xdebug helper请求会话时激活