1

I just run into a weird issue. Maybe a XDebug issue.

I just configured XDebug for the first time in my dev environment, it works okay,I use PhpStorm and the integrated IDE to test my code, it's fine.

The problem is actually when I don't use the debug mode, for instance, if I start to debug and then I stop the debug process then my PHP script will get slower, around 5/8 seconds to display a hello word. (but with some logic behind) while it takes less than one second with the debug mode running.

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"

I set autostart to false to avoid latency while I'm not using the XDebug mode. But once I started it I need to be in debug mode to use the "fast mode".

Any idea why?

I read some topics like Will enabling XDebug on a production server make PHP slower? and one of the answer seems to be about that.

I made some tests just enabling the module, without actually debugging, makes slows down a request on my development machine from 1 second to around 4 seconds

Community
  • 1
  • 1
Vadorequest
  • 16,593
  • 24
  • 118
  • 215
  • 1
    I have experienced similar problems with chrome, if the XDEBUG_SESSION cookie is set and debug is not running, chrome will stall for several seconds to couple of minutes before receiving data from IIS. Affects normal browsing and ajax requests as well. – diynevala May 13 '15 at 06:26

1 Answers1

2

Its likely your profiler,

xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = off

From the manual

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.

So its always making profiles, Which will take much longer, You should only need to profile when you need to know the results of a profile

The debugger at most will try to open a socket. Its allows requests from GET POST and COOKIE. and when you connect, it sets a cookie for 1 hour by default which makes the debugger try and connect to a port each time you request after for 1 hour

exussum
  • 18,275
  • 8
  • 32
  • 65
  • 1
    Thanks, it was that. I thought that was needed by XDebug too. Wrote ~1Go of data in c:/wamp/tmp, I understand better why it was slow... – Vadorequest Mar 09 '14 at 19:08