1

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!

Mario Haubenwallner
  • 1,835
  • 1
  • 17
  • 21
  • 1
    did you solve this? i'm having a similar problem: php7.0-fpm, xdebug, nginx works fine until i start debugging, then i get 502 errors with "recv() failed (104: Connection reset by peer) while reading response header from upstream" – Steve Jan 12 '16 at 02:10
  • No, I wasn't able to solve it. I switched to XDebug and I'm still happy with this move. – Mario Haubenwallner Jan 12 '16 at 07:21
  • [Enabling `catch_workers_output`](https://stackoverflow.com/questions/18379323/failed-104-connection-reset-by-peer) may provide additional info (says *[Zend Debugger] Not connected!* in my case) – ᴍᴇʜᴏᴠ Mar 02 '18 at 15:25
  • I'm having the same issue now with nginx, xdebug and PHPStorm on Ubuntu. – Marek Lisý Jul 23 '21 at 09:59

0 Answers0