Xdebug for remote server not connecting Xdebug for remote server not connecting php php

Xdebug for remote server not connecting


The server running PHP (and XDebug) needs to be able to connect to your workstation/desktop.

Diagram

So you'll need the server set up accordingly by either telling it to connect to a specific IP-address (xdebug.remote_host) or to automatically "connect back" (xdebug.remote_connect_back). The latter has some security implications, though. These are outlined in the manual.


For me, xdebug.remote_connect_back = On does not work.What I did was to set ssh port forwarding on my client machine.

xdebug config on the remote machine:

xdebug.remote_enable=1xdebug.remote_host=127.0.0.1xdebug.remote_port=9000xdebug.remote_autostart=1xdebug.remote_handler = dbgpxdebug.remote_mode = req

forward ports on the client machine:

ssh -g -N -lusername -R9000:127.0.0.1:9000 [remote.host.ip]

The shell access on the remote machine must be allowed.


The key directive is this:

xdebug.remote_connect_back = On

This allows the web server to connect to whatever computer is asking for a debugging session. This way you don't have to hard-code an IP address and are able to share Xdebug. This directive was not present in earlier versions and is often omitted from tutorials and documentation.

You also need to verify that every client computer accepts incoming connections to port 9000 (xdebug.remote_port). This includes configuring the firewall and making sure the debugger client is up and running