Setting up debugging with XDebug 3 and WSL2

Tried the steps mentioned in this post and post. However, debugging continues to fail due to the following error: 

Connection was not established. Cannot start debugger session with 'Xdebug 3.0.4'


XDebug Config:

zend_extension=xdebug.so

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=192.168.173.130
xdebug.remote_port=9000
xdebug.client_host=192.168.173.130
xdebug.client_port=9000
xdebug.log=/var/log/xdebug.log
#xdebug.discover_client_host=false
xdebug.idekey=PHPSTORM

 

This is a portion of the command executed by PHPStorm when debugging:

Unsure as to why the remote_host is passed as 127.0.0.1

php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 "-d xdebug.remote_host=192.168.173.130" "-d xdebug.client_host=192.168.173.130" "-d xdebug.remote_port=9000" -dxdebug.client_port=9000

 

And this is a portion of the command executed by PHPStorm when running a script/test:

php "-d xdebug.remote_host=192.168.173.130" "-d xdebug.client_host=192.168.173.130" "-d xdebug.remote_port=9000" -dxdebug.client_port=9000

In this case PHPStorm does not automatically pass 127.0.0.1 as remote_host's value and only the values setup in the XDebug options in IDE are passed.

Had uninstalled anti-virus and also disabled the firewall. However, debugging connection fails. Strangely nothing is written to xdebug logs.

System Info

PHPStorm Version: PhpStorm 2020.2.4
Build #PS-202.8194.11, built on November 25, 2020
Licensed to Nikhil Ranka
You have a perpetual fallback license for this version
Subscription is active until May 4, 2022
Runtime version: 11.0.9+11-b944.49 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0

Would be great if you could help in setting this up.

Thanks!

36 comments
Comment actions Permalink

I've reproduced the problem with a failing CLI debugging. I'm running some checks now & if all confirms - I'll report it as a bug/usability problem and let you know. 

0
Comment actions Permalink

Submitted as https://youtrack.jetbrains.com/issue/WI-65350 - feel free to vote for it in order to get notified about its updates.

0
Comment actions Permalink

I have Windows 11 + WSL2 with Ubuntu.

My development file are located on ubuntu server.

My configuration:
zend_extension=xdebug.so
xdebug.idekey = PHPSTORM
xdebug.mode = debug
; xdebug.discover_client_host = true
xdebub.remote_enable = 1
xdebug.client_port = 9003
xdebug.client_host = 192.168.1.190
xdebug.remote_port = 9003
xdebug.remote_host = 192.168.1.190
xdebug.log = /var/log/xdebug.log


0
Comment actions Permalink

after add folder mapping it started working

0
Comment actions Permalink

It stop working.

My xDebug configuration:
zend_extension=xdebug.so
xdebug.idekey = PHPSTORM
xdebug.mode = debug
; xdebug.discover_client_host = true
xdebub.remote_enable = 1
xdebug.client_port = 9003
xdebug.client_host = 192.168.1.190
xdebug.remote_port = 9003
xdebug.remote_host = 192.168.1.190
xdebug.log = /var/log/xdebug.log


Xdebug log:

0
Comment actions Permalink

The problem was with Windows Deffender firewall which blocks my connection.
I setup this like here:

0

Please sign in to leave a comment.