if PHP/Xdebug is running on a different physical machine, in a VM, in a container, or similar - it won’t work out of the box. Xdebug can just go to localhost:9003 and hit your client), but if your setup is a little more complicated than that - i.e. This is fine if your setup is relatively simple (i.e. probably your editor or IDE), in order to establish a debugging connection. Xdebug can be tricky to configure, because it works in reverse from the way you’re probably used to interacting with your PHP application - instead of sending requests to your PHP code, Xdebug needs to know how to send requests from where your code is running to your client application (i.e. (Don’t get discouraged by my ultra-convoluted setup - this configuration should actually theoretically work for pretty much any environment, for reasons I’ll get into a little later on.) Preamble I recently spent a good few hours getting Xdebug to work with my development setup (which is PhpStorm running inside WSL 2 on Windows 10, and PHP/Xdebug running inside a Docker container, inside WSL 2, with Docker Desktop), so here I am writing up the surprisingly simple solution I ended up with - partially for my own future reference, but also to help out anyone who finds themselves in a similar situation. PHP Debugging With Xdebug 3 Inside a Docker Container
0 Comments
Leave a Reply. |