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!
请先登录再写评论。
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.
Submitted as https://youtrack.jetbrains.com/issue/WI-65350 - feel free to vote for it in order to get notified about its updates.
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
after add folder mapping it started working
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:
The problem was with Windows Deffender firewall which blocks my connection.
I setup this like here: