Xdebug cannot connect to remote DBGp Proxy

Viewed 292

I am running Xdebug extension on PHP webserver (IIS), and VSCode on different development machine.

When I start listening for Xdebug session in VSCode (with Felix Becker's PHP Debug) without proxy, everything works as expected.

Now I am trying to use dbgpProxy because there are multiple devs on the development machine.

I have tried to run dbgpProxy on the webserver and register to it by activating proxy settings in VSCode, but it fails with Connection refused. At the same time, Xdebug connects to the proxy just fine and proxy tries to forward incoming session based on IDE key but of course cannot find it because the registration failed.

So I tried running dbgpProxy on the development machine. This time VSCode registered successfully with the proxy, but when Xdebug tried to connect to the listening proxy, it failed.

I was pretty sure I knew what I was doing, ports were open, everything SHOULD work but it didn't.

1 Answers

It turned out to be a problem in the IP addresses.

I ran the proxy with default settings, which is localhost (127.0.0.1) for both server and client part with respective ports 9000 and 9001. Which was wrong (for my situation).

To listen to the incoming connections from another machine, proxy has to be configured with real IP address of the machine it is running on, otherwise it won't listen.

In my case I have decided to run the proxy on the server, so I run it with just one parameter for the incoming client connections and leave the server parameter default (which is 127.0.0.1:9000 and of course configure XDebug in php.ini to this address and port).

dbgpProxy.exe -i 10.123.54.76:9001

Related