Skip to content

Instantly share code, notes, and snippets.

Last active November 6, 2020 09:36
Show Gist options
  • Save cliffordp/e4a20acd982d72d1177396c10b382436 to your computer and use it in GitHub Desktop.
Save cliffordp/e4a20acd982d72d1177396c10b382436 to your computer and use it in GitHub Desktop.
Local (Lightning) Xdebug setup with PhpStorm

1) Local Lightning

Local Lightning works differently than the previous version of Local. This guide is for Lightning.

Install and activate the "Xdebug + PhpStorm" Local add-on. You'll need to restart Local app to complete installation.

Whenever a new site is added click its "Utilities" tab, then click "Add Run Configuration to PhpStorm" to insert "Local" with your site's URL as a "PHP Web Page > Server" in the Configurations, then specify its root location via Path Mappings.

2 min video walk-through (requires the following to be completed already... so continue below before trying to trigger an Xdebug breakpoint...)

2) The Copy/Paste

This is the DEFAULT that is already in php.ini.hbs:


REPLACE ☝ that with 👇 this (or your own variation):

;Added by Cliff
;xdebug.profiler_output_dir="/Users/cliff/Local Sites/YOUR_SITE/app/public/xdebug-profiling/" ;make sure folder already exists

3) Edit each PHP version's ini file

Go to a site in Local > Reveal in Finder:

  • site folder > conf > php > php.ini.hbs

If you started the site in PHP v7.3.5, for example, but then you switch it to PHP v5.6.39, you'll need to edit an additional ini file:

  • site folder > conf > php-5.6.39 > php.ini.hbs

Same for each additional PHP version you eventually add... per site.

4) Setup PhpStorm

Preferences > Languages & Frameworks > PHP > Debug > Xdebug > set Debug port to 9001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment