Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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:

xdebug.remote_enable=1
xdebug.remote_connect_back=Off
xdebug.remote_port="9000"
xdebug.profiler_enable=0

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

;Added by Cliff
xdebug.remote_port=9001
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.var_display_max_depth=-1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
;xdebug.profiler_enable=1
;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
You can’t perform that action at this time.