

If you install the debugger package, and try to run the debugger it will start throwing errors.

VS Code came with support for NodeJS debugging out of the box, so I expected things to be as straightforward for PHP, since it’s more widely used.įirst, you need to install the PHP Debug extension for VS Code by either running the following command in the command palette or searching for the package in the extensions menu: ext install php-debugįrom here is where things got murky for me. Typically, this helps you resolve issues a lot quicker, especially when something isn’t solved easily by printing out a few key variables. Enter interactive debugging, which allows you to inspect different variables as the program is executing and step through functions and control flow structures until we decide to release certain breakpoints. One of the reasons I use VS Code is because of its capabilities as an interactive debugger, but how is that different from other types of ‘debugging’?įor a lot of things in development, we can get away with having the program print out some information as it is executing, think console.log for JS or echo, var_dump for PHP, and so on.īut as things get more complicated, you might need to get a better look at what is going on underneath the hood. Although this setup might not work for everyone depending on your environment, it will save anyone using MAMP already a hell of a lot of time. This is the blog post I wish existed a few weeks ago when I started trying to configure Visual Studio Code to debug PHP and WordPress interactively. Septem| Posted in Web Development, WordPress
