Before we set up Xdebug, I want to talk through how it works so the setup makes more sense and it doesn't seem like a series of strange steps.
Before we set up Xdebug, I want to talk through how it works so the setup makes more sense and it doesn’t seem like a series of strange steps. Plus, it’s important to understand, at least at a high level, how the tools you use work.
As I mentioned in the last video, Xdebug is a PHP extension and runs on the local server as part of PHP that runs your application. Our web server that runs the site via PHP would have Xdebug installed and enabled in order for us to use.
When Xdebug is running, it will call back to your IDE (like PhpStorm or VS Code) from the server where it’s running. Your IDE will sit and listen for that connection on a specific port (typically port 9000 or 9003).
You load a page in the browser for your project and when that happens Xdebug sends a connection request to your IDE and says “hey, I am getting a request, what do you have for me?”. At this point, Xdebug and your IDE start communicating via the [[DBGP protocol]]. This sounds fancy (and maybe it is) but it’s just a protocol create by Xdebug for communcation between itself and an IDE.
Explanatory chart I use in the video via the article Understanding XDebug using Message Sequence Charts (mscgen)
Debugging with Xdebug is made up of the following videos: