Xdebug + VS Code does not work with Local

Hi @jim_hubbard

One of our Devs tested getting this working on a Windows machine with Local 7.2.1 and VSCode. They were able to get it working just by following the steps on the Xdebug Add-On page. The warning did pop up regarding not being able to validate due to an invalid PHP executable, but that’s able to be closed out and ignored.

Here are the steps taken for the initial install:

  1. Install Local
  2. Install the XDebug VSCode plugin
  3. Create a new preferred site
  4. Click the Add Run Configuration to VS Code button under the Tools tab
  5. Enable XDebug on the site in question
  6. Open VSCode
  7. Install the PHP Debug extension
  8. Add the site’s /app/public directory to the VSCode workspace
  9. Verify the launch.json config exists within your site’s .vscode folder (from step #4)
  10. Add a breakpoint (I put mine in the wp-config.php file where the DB_NAME is defined)
  11. Navigate to the VSCode debug tab and start listening for XDebug using the newly created config
  12. Start your site in Local and verify VSCode catches at your breakpoint

Let us know if that helps or what other questions or issues you might have here!

2 Likes