·

Within your WSL run:

sudo apt update
sudo apt install php-xdebug
php -v
output:

$ php -v
PHP 8.4.14 (cli) (built: Oct 27 2025 20:53:30) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.14, Copyright (c), by Zend Technologies
    with Xdebug v3.4.7, Copyright (c) 2002-2025, by Derick Rethans
php --ini | grep xdebug
output:

$ php --ini | grep xdebug
/etc/php/8.4/cli/conf.d/20-xdebug.ini,
hostname -I | cut -d ' ' -f1
$ hostname -I | cut -d ' ' -f1
172.30.40.150
sudo vim /etc/php/8.4/cli/conf.d/20-xdebug.ini
zend_extension=/usr/lib/php/20240924/xdebug.so

xdebug.mode=debug,develop
xdebug.start_with_request=yes

; PHPStorm listens on 9003
xdebug.client_port=9003

; WSL2  Windows host IP (always dynamic)
xdebug.client_host = xdebug.client_host = 172.30.40.150

; Optional: useful only when debugging failures
;xdebug.log = /tmp/xdebug.log
;xdebug.log_level = 7

Now in the PHPStorm:

Go to:

Settings → PHP → CLI Interpreter (or Ctrl + Alt + S)

Select WSL/usr/bin/php

After this…


Create your own user feedback survey

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *