1

I'm trying to set up remote debugging for PHP using Xdebug and PhpStorm. My local development machine has Windows 7 and the remote machine has CentOS 6.

I'm following this guide to no avail:

https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel#RemotedebugginginPhpStormviaSSHtunnel-1.XdebugorZendDebuggerinstalledandconfigured

I can connect to SSH just fine and my tunnel settings are exactly like in the guide:

enter image description here

When I try connect to the server via browser (with appropriate cookies set up) I get the following error in the Xdebug logs:

# tail /tmp/xdebug.log
Log opened at 2016-05-25 09:53:36
I: Connecting to configured address/port: 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2016-05-25 09:53:36

Log opened at 2016-05-25 09:55:36
I: Connecting to configured address/port: 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2016-05-25 09:55:36

Here's my /etc/php.d/xdebug.ini:

; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="/tmp/xdebug.log"

Xdebug is listed in phpinfo() output and it successfully writes errors to the log, so I don't think that the problem is in the Xdebug's configuration. PhpStorm is listening for connections and I can debug sites on my local machines with no problems, but the remote debugging doesn't work.

It seems that PuTTy can't establish an SSH tunnel.

Here's the list of the opened ports on the server:

# netstat --listening -n
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::80                       :::*                        LISTEN
tcp        0      0 :::22                       :::*                        LISTEN
tcp        0      0 ::1:25                      :::*                        LISTEN
udp        0      0 0.0.0.0:68                  0.0.0.0:*

As far as I understand, there should be something listening on the 9000 port. Otherwise how else is PuTTy going to forward the data from the server to my local machine? Any ideas on how to fix it and establish a proper connection? Maybe it's related to selinux or SSH configuration?

migrated from serverfault.com May 25 '16 at 10:19

This question came from our site for system and network administrators.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.