Nginx php-fpm xdebug netbeans can start only one debugging session

In the past, I used apache + mod_php + xdebug + netbeans to develop my site (the server is my local machine working with Debian Squeeze), with pleasure - xdebug worked as expected, debugging sessions can be started and stopped at any time, when i need it. But when I switched to nginx + php_fpm + xdebug + netbeans, I had some debugging problems.

  • My debugging session can be very long (much more than 30 seconds) and it seems that nginx could not wait for so long, it shows “504 Gateway timeout error” . I tried many recommendations to solve this problem, but no luck. Although, this is not very important for me, since the debugging of the session itself continues to work, and it is a little inconvenient.
  • My debugging session can only be started once, so if I stopped it and try to start debugging again, netbeans will not be able to accept the xdebug connection (it says "Waiting for xdebug connection" and this is forever). After rebooting netbeans, the debugging session can be started again normally.
  • In the following cases, which I could not understand, debugging is “enabled for all php scripts” and prevents any other scripts from being run. For example, I start a debugging session on my website http: //mysite.local/index.php and work with it. After some time, I noticed that my administrator (located on intranet.local / adminer.php) does not start, the browser tries to load the page for some time, and then shows “Gateway 504 timeout error”, If I see this behavior, I can just terminate the xdebug debugging session in netbeans, and all other scripts will start working fine.

Now, when I write this question, I have done some research and found that if I started a debugging session within a few seconds, then stop it and start again - it will start normally. It seems that the problem occurs after some time of active debugging.

My system and applications: Debian compression: 2.6.32-5-686 Nginx: 1.4.1 (from dotdeb repository) php5-fpm: 5.3.26-1 ~ d (from dotdeb repository) php5-xdebug: 5.3.26-1 ~ d (from dotdeb repository) netbeans: 7.3

My configuration:

Writing to the nginx error log file if it cannot wait for the script or other script to be debugged, blocked by problem No. 3 mentioned earlier:

2013/08/14 14:40:16 [error] 4822 # 0: * 111 timeout by time (110: connection timeout) while reading the response header up, client: 192.168.100.1, server: intranet.local, request : "GET / adminer.php? Username = root & db = devel & table = user HTTP / 1.1", upstream: "fastcgi: //127.0.0.1: 9999", host: "intranet.local", referrer: " https: // intranet .local / adminer.php? username = root & db = devel "

The php-fpm logs do not contain ANY error messages ...

I do not like to bother everyone with my problems and always try to solve it myself. But in this case, I have been fighting this for some MONTHS without any luck ... If someone has encountered these problems or you have a working configuration for use with nginx + php-fpm + xdebug + netbeans - please help me :)

+6
source share
2 answers

Thank you, everyone who tried to think in the direction of my problem. I successfully resolve it.

  • The first problem (with error 504) can be solved with the nginx option fastcgi_read_timeout , for example, it can be fastcgi_read_timeout 600; to tell nginx that it should wait 600 seconds. It must be placed in the host configuration file or in / etc / nginx / fastcgi _params (on Debian).
  • The second problem was caused by an option in my xdebug.conf: xdebug.remote_autostart=1; , it should be xdebug.remote_autostart=0; . I do not understand the real meaning of this parameter, but it does the following: Any PHP script automatically tries to connect to the debugger (netbeans in my case). Thus, in some cases, netbeans loses connection, and when I click "Start debugging", it does not know that the new connection should be open and wait for the xdebug client forever. Now, with this option, I can start and stop debugging anytime I need it.
  • The third problem had the same source as the second. All other scripts running on my server tried to connect to netbeans, but with a lost connection it was pointless.

In any case, I hope this helps someone who wants to solve such problems. StackOverflow helped me make me specifically describe my problem, and in the process I got new ideas on what to try.

+11
source

When updating fastcgi_read_timeout, you can increase the time limit for all sites on the server (in my case, Vagrant homestead VM), you can do the following as soon as you log into your virtual machine:

 sudo pico /etc/nginx/nginx.conf 

and add

 fastcgi_read_timeout 300; 

to the http section.

+2
source

Source: https://habr.com/ru/post/951707/


All Articles