How to get Xdebug to work on v5.0.7+

Wanted to post this here to help everyone who may be experiencing issues with Xdebug and phpstorm not working anymore. Since updating from Local by Flywheel to Local Lightning, Xdebug has discontinued working because the PHP module php-fpm listens on the default xdebug port of 9000. Change the setting ‘xdebug.remote_port’ to 9009 (as long as no other service/worker is listening in on 9009) in phpstorm and restart your site. Xdebug will work again!


Sentence correction:

Change the setting ‘xdebug.remote_port’ to 9009 (as long as no other service/worker is listening in on 9009) in your site’s php.ini file and in phpstorm’s (or other IDE) Xdebug listening port setting. Restart your site to have the changes take effect.

In case anyone else comes across this and is a bit unclear…

/Users/YOU/Dropbox/local-sites/SITE/conf/php/php.ini.hbs is the correct file to edit. It’s got this extra “.hbs” to be a Handlebars file.

Open this file in a text editor (like PhpStorm), search for “xdebug”, and make your changes, like I did:


; Below was added by Cliff. Commented lines above are just to keep record of what the defaults were.
xdebug.profiler_output_dir="/Users/YOU/Dropbox/local-sites/SITE/app/public/_xdebug-profiling/" ;make sure folder already exists

Then right-click your site in Local app and click “Restart” for your changes to take effect.

Then set your PhpStorm to listen at the right port (9001 in my case), setup the index.php path, and it works: (1min gif demo)

I have tried changing the port to a free one but it’s still not working. I’m currently working off of Local 5.2.5 with VS Code.

Any other ideas on how to get Xdebug to work on this version?


I was struggling with this again, too!

Turns out the site was loading via HTTP instead of HTTPS (imported the HOME/SITE URLs from a public site on HTTP)

Once I changed from HTTP to HTTPS, Xdebug started working, as documented above.

You can force to HTTPS in your General Settings (HTTP --> HTTPS) or add Nginx/Apache redirect from this other thread.

But then after it did trigger (only after on HTTPS), it also triggered on HTTP… so maybe it was because I added Path Mappings once the prompt triggered when hit via HTTPS