在激活XDebug但没有运行调试会话的情况下Php变慢

时间:2014-03-09 18:21:51

标签: php xdebug

我遇到了一个奇怪的问题。也许是一个XDebug问题。

我刚刚在我的开发环境中配置了XDebug,它运行正常,我使用PhpStorm和集成的IDE来测试我的代码,没关系。

问题实际上是我不使用调试模式,例如,如果我开始调试然后停止调试过程,那么我的PHP脚本会变慢,大约5 / 8秒显示一个问候字。 (但有一些逻辑背后),而调试模式运行只需不到一秒钟。

的php.ini

zend_extension = "c:\wamp\bin\php\php5.4.12\ext\php_xdebug-2.2.3-5.4-vc9-x86_64.dll"

[xdebug]
xdebug.remote_autostart = 0
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

我将自动启动设置为false以避免延迟,而我没有使用XDebug模式。但是一旦我启动它,我需要处于调试模式以使用“快速模式”。

知道为什么吗?

我读了一些像Will enabling XDebug on a production server make PHP slower?这样的主题,其中一个答案似乎与此有关。

  

我做了一些测试,只是启用模块,没有实际调试,使我的开发机器上的请求从1秒减慢到大约4秒

1 个答案:

答案 0 :(得分:2)

它可能是你的探查者,

xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off

来自手册

xdebug.profiler_enable_trigger
Type: integer, Default value: 0
When this setting is set to 1, you can trigger the generation of profiler files by using the XDEBUG_PROFILE GET/POST parameter, or set a cookie with the name XDEBUG_PROFILE. This will then write the profiler data to defined directory. In order to prevent the profiler to generate profile files for each request, you need to set xdebug.profiler_enable to 0.

所以它总是制作个人资料,这需要更长的时间,您只需要在需要知道资料的结果时进行剖析

调试器最多会尝试打开一个套接字。它允许来自GET POST和COOKIE的请求。当你连接时,它默认设置一个cookie 1小时,这使得调试器每次请求1小时后尝试连接到端口

相关问题