The method of the Xdebug working is the IDE should open a port for connection, then we debug session is comming, the Xdebug extension will connect to the location and the port you defined in php.ini or you $_REQUEST['REMOTE_HOST']
by default.
In WSL, we mostly use localhost
to visit the web server. but the php server in the WSL cannot connect to the Windows by using 127.0.0.1
. So, we need to change the config in php.ini
using this config.
# Set to your Xdebug location
zend_extension=xdebug.so
# When the Xdebug version >= 3, this option will open debug mode