I am trying to convert my recent XAMPP development setup to a LAMP stack based on WSL2.
So far I've been successful. I can access my testpage test.php
containing <?php phpinfo();
via https://localhost/test.php
(using a self-signed certificate for dev-purposes.)
Sadly, I'm completely stuck at getting Xdebug to work.
Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
I have been going through these threads already, but to no avail:
My setup:
- Windows 10 with WSL2 installed
- Ubuntu 20.04 with Apache2
- PHP 8.0.5 with Xdebug 3.0.4
- PhpStorm (IDE)
My Xdebug settings at /etc/php/8.0/apache2/php.ini
:
[xdebug]
xdebug.mode=debug
xdebug.remote_port=9003
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.remote_host=localhost
xdebug.idekey=PHPSTORM
xdebug.discover_client_host=1
;xdebug.client_host=localhost
;xdebug.remote_enable=1
;xdebug.remote_handler=dbgp
I have tried commenting "discover_client" and explicitly setting the client host to localhost. No change.
The output of phpinfo() seems to indicate that these settings are not ignored. See screenshot of the relevant parts.
The relevant settings for the virtual host in /etc/apache2/sites-available/default-ssl.conf
are:
<VirtualHost: *:443>
ServerName localhost
DocumentRoot "/mnt/d/projects/testproject/public"
<Directory "/mnt/d/projects/testproject/public/">
Options +Indexes +Includes +FollowSymlinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
(The "all granted" is only temporary while debugging)
I don't know if this is relevant, but I made sure that C:\Windows\System32\drivers\etc\hosts
contains
127.0.0.1 localhost
::1 localhost
So when I run
php -dxdebug.mode=debug /mnt/d/projects/testproject/public/test.php
I get
Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
Does anyone see the problem? Or can anyone give me a hint on where to look next?