Setup
- Docker host on Windows using WSL 2 engine
- Linux (Ubuntu-20.04) WSL 2 Distribution with WSL 2 integration
- Docker container (
webdevops/php-apache-dev
) started from Ubuntu - Container port mapping 8000:8000
The PHP Web Application in the docker container is now reachable from Windows host via http://localhost:8000
Running PhpStorm on Windows and this Xdebug settings in the php-apache-dev container:
xdebug.remote_connect_back = 0
xdebug.remote_host = host.docker.internal
Xdebug connects to PhpStorm at port 9000, debugging is fine.
xdebug log:
I: Connecting to configured address/port: host.docker.internal:9000.
I: Connected to client. :-)
...
If I run PhpStorm on Ubuntu, Xdebug is not able to reach PhpStorm.
Xdebug Log:
I: Connecting to configured address/port: host.docker.internal:9000.
E: Time-out connecting to client (Waited: 200 ms). :-(
How am I able to debug the php application in PhpStorm starting from my WSL2 Ubuntu?
The reason why is performance. PhpStorm file indexing in Ubuntu is quite faster than from Windows via \\wsl$\Ubuntu-20.04