A
A
Alexey Kuznetsov2013-12-12 11:08:26
PHP
Alexey Kuznetsov, 2013-12-12 11:08:26

Why does Xdebug hang the server if there is no listener?

I work under Windows. The server is on a virtual machine. Xdebug is used very often, so it is configured to work all the time:

zend_extension=/usr/local/php-5.3.15/lib/php/xdebug.so
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.remote_enable=1
xdebug.remote_host=192.168.56.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
xdebug.remote_connect_back=0

I open PhpStorm, start listening for connections on port 9000. Everything works fine. I launch the application and debug. The problem appears if you close PhpStorm or disable wiretapping. When the application starts, xdebug knocks on port 9000 in the hope of finding a listener. Windows, unlike Linux, does not give an answer that the port is not open and the whole script hangs for several seconds until xdebug believes that there is no listener.
Is there a possibility to solve this problem? Maybe some kind of intermediate listener on Windows, which will send a request to another port to the main listener or give a negative response to xdebug if there is no main listener?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Kuznetsov, 2013-12-14
@Webtoucher

Actually, I solved the problem myself. DBGp proxy comes to the rescue. Download Python Remote Debugging Client . Moreover, where exactly you will put the proxy depends on your server. If this is a virtual machine that knocks on your system through NAT, then setting a proxy on it is not very reasonable. It will be difficult to set up debugging for multiple IDEs. All incoming connections will come from ip 127.0.0.1, which will not allow the proxy to correctly determine which IDE to redirect reverse requests to. In this case, download the version for Windows and deploy it on it. For real servers, the Linux version is perfect.
Well, it is desirable to correct the configuration:
xdebug.remote_autostart=0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question