Remote debugging: Problems connecting PHPStorm on windows via WSL2

Hi Folks!

I have a minikube k8s running on a remote host with a PHP app deployed. My dev machine runs PHPStorm on Windows 11. On this machine I use the okteto binary within WSL2 to connect to the cluster. Deploying the okteto dev container with filesync is working smoothly so far, but I’m having problems setting up remote debugging. The connection from Xdebug 3 to PHPStorm doesn’t seem to work.

My reverse tunnel setting are as follows:

    environment:
      XDEBUG_MODE: debug
      XDEBUG_SESSION: 1
      XDEBUG_CONFIG: "client_host=127.0.0.1"
      PHP_IDE_CONFIG: "serverName=dev.test.com"
    reverse:
      - 9003:9003
    interface: 0.0.0.0

For further testing I’ve started a Xdebug commandline debugclient (Xdebug: Documentation » Command Line Debug Client) in a WSL2 terminal, xdebug connects as soon as I start a php script in the container. So the okteto reverse tunnel seems to work.

I think the problem might be that PHPStorm’s debugclient connects to the Windows network and not to the network within WSL2 where the okteto reverse tunnel is established.

Any help appreciated :slight_smile:

Hi @holger,

Thank you for reaching out. We’re sorry to hear that you’re having trouble with remote debugging.

Regarding the issue you’re seeing, it’s possible that this is a limitation with either Jetbrains Webstorm or the WSL2 network. However, we want to let you know that Okteto CLI is available as a native Windows version too, which may mitigate the network error you’re facing.

Let us know if you have any other questions or concerns.

Hi @provecho,
thanks for the reply! I guess that would certainly work, using the windows version of okteto, but we want to stay as much as possible on the linux side with our development workflow. I’ll investigate further to see if there are possibilities to use the reverse tunnel within wsl.