- Published on
DDEV Xdebug Troubleshooting
- Authors
- Name
- Susanne Moog
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003
Do this first: check all the troubleshooting checks in the official docs:
If those do not solve your problem, try the following.
- Make sure the listener in PHPStorm is active (and check which ports it listens to in Settings → Xdebug).
- In the hosts (WSL2) command line, execute:
sudo lsof -i :9003 -sTCP:LISTEN
If the result looks like this (note TYPE):
sudo lsof -i :9003 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 4478 susan 77u IPv6 605887 0t0 TCP *:9003 (LISTEN)
You may need to change the PHPStorm config to listen on IPv4 instead to allow docker to connect with host.docker.internal:
- In PHPStorm, go to “Help” → “Edit Custom VM Options”
- Add the line:
-Djava.net.preferIPv4Stack=true
- Restart PHPStorm and the listener
- Check again with
sudo lsof -i :9003 -sTCP:LISTEN
that it's now listening on IPv4. It should look like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 3111 susan 45u IPv4 620604 0t0 TCP *:9003 (LISTEN)
Then try if it's working now:
ddev ssh
telnet host.docker.internal 9003
— should result in
$ telnet host.docker.internal 9003
Trying 192.168.65.2...
Connected to host.docker.internal.
That's it — it should be working now.