502 Bad Gateway with Zend Debugger (nginx+php5-fpm) and PHPStorm

Wednesday, November 4, 2015

I'm trying to set up the debugging on a server but it won't work.



Here is my setup:




  • Nginx with PHP 5.5.9 (fpm, unix socket) @ 192.168.1.40

  • Network share with source code @ 192.168.1.50

  • The network share is mounted on the webserver at /shared/www/

  • My project is located under /shared/www/myProject and get accessed by http://myProject.local/

  • Zend Debugger is installed, the following is from the php.ini:


    zend_extension="/usr/lib/php5/20151104/ZendDebugger-5.5.x-64bit.so"
    zend_debugger.allow_hosts=192.168.1.0/24,127.0.0.1
    zend_debugger.expose_remotely=always



  • The website is working as intended and I don't have problems there.

  • My workstation has the IP 192.168.1.10



Now my PHPStorm settings:



File -> Settings -> Languages & Frameworks -> PHP




  • PHP language level 5.5

  • Interpreter: 192.168.1.40 (I get correct PHP-Version; Debugger: Zend Debugger, correct configuration file)



File -> Settings -> Languages & Frameworks -> PHP -> Debug




  • Zend Debugger port = 10137

  • [x] Can accept external connections



File -> Settings -> Languages & Frameworks -> PHP -> Server



New server added: 192.168.1.40:80 - Zend Debugger



[x] Use path mappings:
File/Directory: \192.168.1.50\shared\www\myProject



Absolute path on the server: /shared/www/myProject



I've configured zDebug for Chrome this way:




  • Debug Host: 192.168.1.10

  • Debug Port: 10137

  • [x] Check for Zend Debugger Cookie

  • [x] Use Fast File

  • [x] Debug Local Copy

  • [x] Disable Right-Click






Now with the config out of the way here is my problem with the debugging:



If I click on "Debug this page" (doesn't matter if I use the marklets or the Chrome extension) the site loades a minute or so and I'm getting a 504 Gateway Timeout from nginx.



Now if I click on the "Start Listening for PHP Debug Connections" (for zero-config debugging) and try the debug again, I'll get instantly a 502 Bad Gateway.



I really have no idea why I'm getting this error. Nginx error logs say this:




2015/11/04 18:11:05 [error] 4613#0: *107 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.10, server: 192.168.1.40, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "192.168.1.40"




If I disable the debugging there is no error at all.



Does someone has any ideas about this problem? I've searched all PHPStorm documentation but to no avail.



Thank you!

0 comments:

Post a Comment