PHPStorm, MAMP and Xdebug – How to keep (some of) your hair
I’m mostly logging this here for my own benefit, but if the Google gods brought your here, sweet!
Just came across another fun quirk with running Xdebug, MAMP and PHPStorm together. ????
I’ve talked about this combination causing me issues in the past, but this is a whole new situation that killed a couple hours for me.
So, it appears that for PHPStorm to pick up Xdebug correctly, the
xdebug.remote_host variable needs to be set correctly. It normally is, if you copy-pasta some of the tutorials on the internet.
Unfortunately, for some reason, this Monday morning, setting this value to
localhost no longer worked. Why? Welp, localhost is pointing to an invalid folder location, according to MAMP. Apparently this was enough for PHPStorm to freak out and just not run Xdebug. Period.
So how’d I figure out this was the reason for Xdebug throwing up?
The PHPStorm docs of course! Wayyyyy at the bottom of this page it’s plainly stated:
Remote host is configured as ‘localhost’ despite server host is probably not local
The URL to validation script contains something different from localhost, but the xdebug.remote_host value is not set and so is using the default value of localhost, or is set to localhost or 127.0.0.1.