What the issue ended up being is embarrassing!
I had used the xdebug configuration as the entire launch.json
file:
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html/wp-content/plugins/my-plugin": "${workspaceFolder}/"
}
}
As opposed to the correct:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html/wp-content/plugins/my-plugin": "${workspaceFolder}/"
}
}
]
}
Older and wiser!
For other debuggers, this was my path:
The output of adding to index file: xdebug_info();
includes:
[Step Debug] Creating socket for ‘host.docker.internal:9003’, poll success, but error: Operation now in progress (29).
and
[Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) 🙁
Within the docker container:
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
contains expected: zend_extension=xdebug
In the host, OS X computer:
$ nslookup host.docker.internal
Server: 2001:578:3f::10
Address: 2001:578:3f::10#53
** server can't find host.docker.internal: NXDOMAIN
And in the container, /etc/hosts
:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.25.0.5 9cf0413e6c4f
Also /etc/resolv.conf
:
nameserver 127.0.0.11
options ndots:0
On the guest, installed apt-get update && apt install dnsutils
, for
# nslookup host.docker.internal
Server: 127.0.0.11
Address: 127.0.0.11#53
Non-authoritative answer:
Name: host.docker.internal
Address: 192.168.65.2
Adding this to my (host computer) hosts file: 127.0.0.1 host.docker.internal
did not help.
Wait a minute?
Why does VS Code keep telling me there isn’t a launch.json
file, then opening it when I direct it to create one? And… see above. : )