How to get Xdebug working on PhpStorm with PHP 8 in April 2024

Notes to self that might also help you…

After struggling for too long, I followed the nuclear route at Xdebug nightmare - #8 by Glauber (no longer open to replies or else I would have) as a starting point.

Since it worked, I compared why it worked vs my existing PhpStorm project’s settings and the only difference was the port.

So to find the port# you need, go to your phpinfo() output and see $_SERVER['SERVER_PORT']
You could also acquire this on Mac by going to this file in Finder: ~/Library/Application Support/Local/run/router/nginx/conf/route.YOURSITE.local.conf

You don’t need Path Mappings or anything else. This works:

Then you setup your Configuration, then Validate should work (green check marks):

Of course, all the other Xdebug stuff applies, but you do NOT need a browser extension, and you do not need the “Xdebug + PhpStorm” LocalWP extension - although it’d make sense if it correctly added the port# instead of inserting as 80 - therefore, this is a bug report for that extension.

LocalWP v9.0.1+6673
Xdebug + PhpStorm extension v2.0.2
PHP 8.0.30
macOS 14.4.1