The Xdebug client for VS Code listens on IPv6 only - relying on Windows magic to allow IPv4 connections to localhost.
This causes an issue when trying to connect from a docker container running under WSL2, trying to connect back to VS Code listening inside WSL on port 9003 - xdebug in the container can't connect to it.
If I use the other xdebug extension (felixfbecker.php-debug) it supports a "hostname" option in launch.json, so I can easily specify 127.0.0.1 there and force IPv4, but the Devsense extension doesn't support this in launch.json.
I have to disable the entire devsense add-on to use the other xdebug add-on.
Xdebug config (running on a container built from the 'php-fpm' image)
[xdebug]
xdebug.mode=develop,coverage,debug,trace
xdebug.start_with_request=trigger
xdebug.discover_client_host=false
xdebug.client_host=host.docker.internal
Launch.json including the 'hostname' option supported by the other extension:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"hostname": "127.0.0.1",
"port": 9003,
"log": true,
"pathMappings": {
"/opt/getjohn/module":"${workspaceRoot}",
"/opt/getjohn/container/magento/vendor":"${workspaceRoot}/.docker/vendor"
}
}
]
}
```