March 12, 2021
Visual Studio Code Xdebug Launch.json File Configuration

This is the launch.json debugging configuration I use when debugging PHP code using Xdebug in Visual Studio Code. All you need to do is replace [absolute path] with the absolute path of your server’s project root directory. For example, when using Laravel Homestead your absolute path would look something like /home/vagrant/sites/project-root.

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "pathMappings": {
        "[absolute path]": "${workspaceFolder}"
      },
      "port": 9000
    }
  ]
}
Copyright © 2022 Allan Kiezel – Long Island Web Designer & App Developer. All rights reserved.