I have been trying to figure out what’s going wrong for hours now and finally broke down to ask for help. Prior to yesterday, I have been using Xdebug with Visual Studio Code with no problems at all. I’d add a breakpoint, and when I would run Postman to call a custom endpoint, VSC would break, at which point I could step through the code.
At some point yesterday, breakpoints just stopped working. I have checked the “ENABLE XDEBUG” toggle, and it’s on. I checked the PHP.ini settings in wrench screen, and they look correct, which I’ll post below. I have looked through what I believe is the main post about Xdebug issues dating back to 2021 before there was integrated support for Xdebug in DevKinsta, Checked the VSC launch file many times, I’ve updated Xdebug with the Xdebug installation wizard, googled all sorts of Xdebug related topics, and nothing has helped. At this point, debugging is silent in VSC.
All of the functionality related to the endpoint is working as it should. It’s just that the Xdebug functionality stopped without me knowing why.
Any help with this issue would be much appreciated, but I’m a bit stuck here until I can get debugging functional again.
Kept working on this today and was finally able to get it working again. However, I want to understand this more in case something goes wrong in the future. The issue was that my port in the “xdebug.client_port” in PHP.ini was set to 9003, which I believe is the default setting. However, even if I change my Visual Studio Code laungh.json port to 9003, Xdebug does not respond. If I change it back to 9000 in the launch.json file, then change the “xdebug.client_port” to “9000” in the DevKinsta wrench tab, then everything works.
I don’t understand this, because I would have thought the ports would only have to match. Does anyone have any ideas why port 9003 is not working? Is that port taken up by another app running on my Mac? I haven’t looked into that in any depth, but if that’s possible, does anyone know of a good tool for finding out what ports are in use in macOS?
So it looks like maybe the lsof didn’t reveal it because it’s running on a docker internal address/namespace, so you might have to find it from within the context of the devkinsta_fpm container shell:
docker exec devkinsta_fpm -c "lsof \| grep :900"
Could you try adjusting the PHP xdebug configuration:
Thank you again for your help with this ZackE. I’m going to leave this alone for now, because everything is working now with the port set to 9000 in both the PHP.ini and the VS Code launch.json file. While I would like to understand more, as always, it’s one of those thing I’ll have to gain knowledge incrementally, probably when something stops working again =) I’ve made a good leap here and hopefully it will keep me going for a good while into the future.