PHP在我的Windows桌面上运行得非常慢,以至于phpMyAdmin需要几分钟的时间才能打开数据库。 下面是运行一个简单的PHPtesting程序的时间比较:
这里是testing程序…
<?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中input“ http://localhost/timer.php ”,testing程序不经debugging即可运行。
本地机器通常是快速的。 正在运行…
什么让PHP运行如此缓慢?
我发现问题是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 🙁
我在Windows Defender中排除了我的网站文件夹和我的xampp文件夹,并在这里解决了一些问题。
我用xdebug idekey设置(xdebug.idekey =“xdebug1”)和Chrome扩展xdebug helper( https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc )解决了我的问题。
*不要忘记禁用remote_autostart(xdebug.remote_autostart = 0)
只有通过请求激活调试(xdebug),使用idekey设置,所以如果调试不需要php处理可以更快/正常,通过铬扩展按钮
我在Windows 10 64位上使用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请求会话时才会被激活
我有xampp相同的问题,问题是WINDOWS的防御者,如果你禁用Windows后卫保护,xampp是更快(正常速度),也可以搜索xampp文件夹在Windows Defender exlusion。 这是解决方案。
我发现Eclipse没有正确结束XDebug会话。 我通过重新启动调试会话并正确结束解决了问题。
解决的PHP – WAMP / XAMPP响应非常缓慢的本地主机/ WordPress的
最简单的方法是去dirive> xamp> php文件夹> search php.ini> clink on top然后找到max_execution_time anset it max_execution_time = 300>现在重新启动xamp>全部完成:)
max_execution_time=300
对于我来说,改变了以上所有内容之后,从https:// localhost更改为https://127.0.0.1