使用xdebug调试程序后程序很慢的原因

有一个原因就是开启调试的会话没有正确的关闭,即PhpStorm这边关闭了而没有通知服务端xdebug关闭,导致服务器资源被耗尽,这时只有重启服务端的服务才可以。

所以必须保证每一个调试会话被正确关闭。可以调用PhpStorm的stop停止调试或者一直走完整个调试会话。

关闭xdebug的性能分析功能,只能xdebug来调试代码。性能分析用xhprof

配置如下:

; XDEBUG Extension
[xdebug]
zend_extension ="D:/wamp64/bin/php/php5.6.16/ext/php_xdebug-2.5.3-5.6-vc11-x86_64.dll"
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="D:/wamp64/tmp"
xdebug.auto_trace = 0
xdebug.show_local_vars=0

xdebug.var_display_max_children=128
xdebug.var_display_max_data=512
xdebug.var_display_max_depth=5

xdebug.idekey=PhpStorm
xdebug.remote_enable = On
xdebug.remote_host=127.0.0.1 //IDE所在机器IP
xdebug.remote_port=9000 //IDE监听的端口号,用来和服务端的XDEBUG通信用
xdebug.remote_handler=dbgp

xdebug.remote_connect_back=1 //这个要加上,否则无法调试,这个配置的作用是当配置的远程IDE的host和端口号有问题时,会通过请求头读取IDE的IP从而完成通信

xdebug.remote_autostart=0

原文地址:https://www.cnblogs.com/dongruiha/p/6804847.html