Xdebug Support: PHP debugging

Hi @sonicviz and @jscotti, I agree that from a PHP development standpoint this is an important feature. I’m assuming when the Roadmap was finalized, basic web design needs were prioritized based on our surveys, interviews and forum engagement. I have notified our developers about this issue and spent a good deal of time figuring out how to get this work. Hopefully this works for everyone:

I based my setup on @sonicviz 's findings and this post. For some reason, using host.docker.internal no longer works and I had to use my ip address. I don’t know if that’s due to a DK change or a Docker one. I also changed the x.debug.idekey to “docker” but I’m not sure if that makes a big difference or not. Another setting I added was xdebug.discover_client_host=true.

Below is my working configuration for Windows 10, WSL2:

/etc/php/7.4.fpm/conf.d

zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.idekey = "docker"
xdebug.client_host = <my ip address>
xdebug.log = /var/log/php/xdebug.log
xdebug.discover_client_host=true

Finding your IP address:

Mac:

ipconfig getifaddr en0

Windows (run command within WSL):

grep nameserver /etc/resolv.conf | cut -d ' ' -f2

Linux:

hostname -I | cut -d ' ' -f1

My launch.json still matches what has been shared.

Tested and working when viewing my WP Homepage:

So based on my many hours of troubleshooting, I think the issue that has popped up can be resolved by editing the xdebug config/restarting that container. Please let me know if this doesn’t work for you and I can put together a more in-depth guide. My goal here was to reproduce the issue and provide a solution while we wait for the DevKinsta update.

3 Likes