启用xdebug远程调试会使apache服务器非常慢

启用xdebug远程调试会使apache服务器非常慢

本文介绍了启用xdebug远程调试会使apache服务器非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果通过设置xdebug.remote_enable=1启用xdebug,apache服务器将变得非常慢;一旦将设置更改为0,这是正常的.

If I enable xdebug by settting xdebug.remote_enable=1, the apache server becomes very slow; once I change the setting to 0, it's normal.

我在这里发现了一个相同的问题: XDebug确实很慢,但是答案没有帮助.我没有启用分析功能:

I found a same question here: XDebug really slow, but the answer isn't helpful. I didn't enable profiling:

xdebug.profiler_enable=0
xdebug.auto_trace = 0
xdebug.trace_output_dir = /tmp/xdebug
xdebug.trace_output_name = trace.%c

我检查了/tmp/xdebug文件夹下没有任何内容.

I checked there's nothing under /tmp/xdebug folder.

启用xdebug远程调试并在PHPStorm中启用调试侦听时,花很短的时间才能在断点处停止,但不如禁用phpstorm调试侦听那样慢.

When xdebug remote debug is enabled and I enable debug listening in PHPStorm, it takes a short while to stop at the breakpoint, but not as slow as disabling phpstorm debug listening.

我的环境是:在本地centos VM上的 php + apache + xdebug ,我的mysql db和PHPStorm在Windows桌面上进行开发. MySQL并不慢.

My environment is: php + apache + xdebug on local centos VM, my mysql db and PHPStorm are on Windows desktop for development. MySQL is not slow.

感谢帮助.

推荐答案

在我的情况下,这是由于

In my case this was caused by having

xdebug.remote_autostart = 1

php.ini 中设置.这导致xdebug在每个请求上尝试连接到远程调试器.我在请求中有一些PHP处理的样式,auto_preppend_file和其他PHP文件,对于每个样式,它都等待了大约2秒,这总计达到了sth.大概15秒左右设置

set in php.ini. That causes xdebug to try to connect to remote debugger on every request. I had some PHP handled styles, auto_preppend_file and other PHP files in the request and for each of them it waited approximately 2secs, which added up to sth. like 15 seconds or so. Setting

xdebug.remote_autostart = 0

彻底解决了问题. xdebug仅在存在调试cookie时连接 .请注意如果您不在调试会话中,则需要删除调试cookie/参数,.

solved the problem completely. xdebug connects only when debug cookie is present. Please note you need to remove the debug cookie/param if you are not in debug session for this fix to work.

这是我用来设置xdebug的配置.

这篇关于启用xdebug远程调试会使apache服务器非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 05:30