0

I configured Xdebug with PhpStorm in a WSL2 Debian instance.

Here is the configuration of my xdebug.ini :

xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=false
xdebug.client_host=${WSL_IP}
xdebug.client_port=9003
xdebug.idekey=PHPSTORM

the line xdebug.client_host=${WSL_IP} is in another file : .bash_aliases

export WSL_IP=$(grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}')

WSL_IP contain the IP of my vEthernet WSL.

In short I used this solution for dynamically get the current IP of WSL every time I reboot my computer.

The main problem is ${WSL_IP} doesn't return the value at the line xdebug.client_host=${WSL_IP}

I even try to write in this way xdebug.client_host=$(echo $WSL_IP) but it didn't work.

So my solution was to get the value of $WSL_IP xdebug.client_host=${WSL_IP} -> xdebug.client_host=[IP Value]

And it works in this way but the problem is every time the WSL IP changes, I have to update the file config in xdebug.ini with the new IP value.

Do you have a solution of why ${WSL_IP} doesn't work in xdebug.ini?

Thanks in advance for your help.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
MrBB
  • 131
  • 1
  • 2
  • 11

1 Answers1

0

From Xdebug 3.2 you can use xdebug://nameserver as value for xdebug.client_host in this situation: https://bugs.xdebug.org/bug_view_page.php?bug_id=00002079

Derick
  • 35,169
  • 5
  • 76
  • 99
  • Interesting to know. Unfortunately I have to use xdebug 3.1. Do you know if there is an alternative for the previous version? – MrBB Jul 06 '23 at 20:47
  • No, there is not. Why do you have to use an old version? – Derick Jul 06 '23 at 23:12
  • For the enterprise where I work. We still have apps with php 7.4 so xdebug version supported to this version of php is 3.1.6. – MrBB Jul 07 '23 at 07:02