

There should be a configurations variable that holds an array of objects. And then click on the small cog icon from the top.Īnother way would be to go to the main menu, click Debug and select 'Add Configuration.'Ĭhoose your environment - this should be PHPĪ new file called launch.json should open up. That's it! Nothing else to do Configure VSCode to run the debuggerĪfter the extension is installed, you can open the Debug section from the left menu. Open Visual Studio Code and install the PHP Debug extension. Adjust path as needed in the volumes section of your docker-compose. This is useful in case your configuration file doesn't seem to work. You can use it to check where php is looking for additional. Then insert phpinfo() in any page and display it. This should confirm that xDebug is installed. You can docker exec in your php service and run php -version in bash. This can be a good time to check that xDebug is loaded

Adjust the path (the one on the left) as needed. This line assumes that your xdebug.ini file is next to your docker-compose file.

xdebug.ini:/usr/local/etc/php/conf.d/xy-xdebug.ini Nevertheless, this information will be used in the next step, when setting up VSCode.įinally, let's adjust our docker-compose file. The other important bit is the client port. this path works with the volume already set up in docker-compose where we mount the /logs/xdebug folder.įor all options and settings available checkout the official documentation. Let's start with xdebug.ini zend_extension = xdebug.so ini file with the configuration that we want, and to adjust our php service container to load that file. Therefore, I have a very simple Dockerfile with these lines: FROM php:7.4-fpmĪnd my docker-compose file will have something along these lines: php: It's built on a PHP-FPM image with a couple of instructions added.

