Search code examples
vscode-extensionsxdebug

VSCode PHP debug ext can not connect to DBGp proxy server


  • PHP version: v8.1.18
  • Xdebug version: 3.2.0
  • web server: Homestead on remote 192.168.10.10
  • DBGp proxy server runs on local Windows 10:
./dbgpProxy.exe -i 127.0.0.1:9001 -s 0.0.0.0:9003
  • xdebug.ini
xdebug.mode = debug
xdebug.client_port = 9003
xdebug.client_host = 192.168.10.1
xdebug.start_with_request = trigger
xdebug.trigger_value = ''
  • PHP debug launch.json
{
    "name": "DBGp Proxy",
    "type": "php",
    "request": "launch",
    "pathMappings": {
        "/home/vagrant/laravel10": "D:\\workspace\\laravel10"
    },
    "proxy": {
        "enable": true,
        "host": "127.0.0.1",
        "port": 9001,
        "key": "vsc",
        "allowMultipleSessions": false
    }
}
  • DBGp proxy server log:
06:46:36.326 [info] [server] Start new server connection from 192.168.10.10:36512
06:46:36.327 [info] [proxy-client] [vsc] Could not find IDE connection for IDE Key 'vsc'
06:46:36.331 [warn] [server] Handler response error: Error reading response: Error reading length: EOF
06:46:36.332 [info] [server] Closing server connection from 192.168.10.10:36512
  • Everything is OK when using PhpStorm:
07:03:13.986 [info] [server] Start new server connection from 192.168.10.10:37788
07:03:13.987 [info] [proxy-client] [PHPSTORM] Found connection for IDE Key 'PHPSTORM': 127.0.0.1:9000
07:03:13.991 [info] [proxy-client] [PHPSTORM] Connecting to 127.0.0.1:9000
07:03:13.994 [info] [proxy-client] [PHPSTORM] IDE connected
07:03:13.996 [info] [proxy-client] [PHPSTORM] Init forwarded, start pipe

I can not find something like Register IDE in VSCode. How to connect VSCode IDE client to DBGp Proxy server?


Solution

  • It registers once you click on the green arrow next to "Listen for Xdebug".

    Similar to when you click on the little "Start Listening For PHP Debug Connections" in PhpStorm.

    As it just happens, I recorded a video yesterday to explain it: https://youtu.be/_3RkGZK-UC8

    I'll follow up with an article version.