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.
I
For me I had
xdebug.remote_connect_back = 1
which slowed everything and stopped remote debugging from working. Once I remove it, everything works fine.
In my case this was caused by having
xdebug.remote_autostart = 1
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
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.
Here is my config that I use to setup xdebug.
Also, if you do want to leave xdebug.remote_autostart = 1 enabled all the time, in your Phpstorm settings try increasing the max simultaneous sections. This should reduce hanging and blocks, but will still result in a performance impact based on my experience.
In my case low performance was caused by having 200+ breakpoints set in PHPStorm which were evaluated on every request by xdebug.
Clearing those breakpoints in PHPStorm increased perfomance from 60 sec to 6 sec per request.
It's likely that there are some networking timeouts that happen here. The best way to find out what's going wrong is to try to debug a command line script. If that still has the same issue, then use strace
to see what it is hanging on:
export XDEBUG_CONFIG="idekey=yourname"
strace -tt -o /tmp/strace.log php full/path/to/script.php
Then have a look at /tmp/strace.log
and see where the slow down happens.
Experienced also low performance with XDebug (loading Captcha in 6 seconds instead of milliseconds) Remarks on this page got me on the way to identify the cause.
Turned off the profiler and loading time was divided by 3. Still slow, but better already.
xdebug.profiler_enable = 0