You can enable Xdebug within MAMP by checking the Activate Xdebug option under the PHP tab.
Xdebugįortunately, Xdebug is already included with MAMP, so there is nothing we need to install in addition to MAMP itself. I also assume that most of this is applicable to the regular, non-pro version of MAMP, though I have not tested it. The same process should also work for MAMP PRO 2 - 4 and for PhpStorm 7 - 2016.2. The screenshots below are from MAMP PRO 3 and PhpStorm 8. So your initial setup isn’t as frustrating as mine was, I thought I'd share how I was able to get it all wired up and hopefully save you some time. After a few days mucking with everything, I was able finally able to get it figured out. Each article seemed to be missing one key piece of the puzzle.
I must have read 8 - 10 articles scattered about the internet to finally get PhpStorm setup to do debugging with Xdebug and MAMP.
Hey, sometimes I post new content, so if you want to stay up to date sign up for my newsletter.Michael Novotny How to Setup and Configure Phpstorm, Xdebug, and Mamp for Debugging January 6, 2015
Just use another version of PHP within MAMP, one that doesn’t use Xdebug. Not sure what the reason is, but the workaround is easy enough. I should note that if you’re running multiple sites on your MAMP install, and 2 of these sites are talking to each other in any way (via AJAX or the WP Rest API etc.), make sure ONLY ONE is running Xdebug. Without the explicit path mappings for the symlinks, Xdebug half worked – which was super confusing... I even needed to map the base of my WP install, since I had checked the ‘Use path mappings’ setting.įor me, that’s all it took to get things running. If you’re using plugins in your local PHP install that are symlinked (and many plugin developers do this), make sure you map those folders for Xdebug and PHPStorm! This is where I got caught many times. You can set this in Preferences > Languages & Frameworks > PHP and selecting the MAMP PHP version you’re using.Īfter that, essentially follow Michael’s guide for setting up PHPStorm with the debug configurations, once PHP is all set up. Make sure PHPStorm is using the same PHP Interpreter you’re using for everything else. You can further check what kind of Xdebug settings your have enabled by running php -i | grep xdebug You can check if Xdebug is available, by running php -version in your CLI. There’s plenty of resources on the inter-web’s for this. Make sure you’ve got Xdebug running and remote_enable=1 is set in your php.ini. This one’s a gimme, but still a point worth making to cover all the bases. In your ~/.bash_profile file you can add something like this.Įcho $PATH | grep -q -s "/Applications/MAMP/bin/php/php5.6.10/bin"Įxport MAMP_PATH=/Applications/MAMP/bin/php/php5.6.10/bin This can be as simple as adding the MAMP PHP version to your $PATH. This can cause all sorts of weirdness, especially with Xdebug, so make sure you’re using your MAMP version of PHP on your CLI. Time and again I’ve seen people have issues with their CLI PHP version and Web server PHP version not matching up. Step 0: Use the same version of PHP for your CLI and your webserver. You’re on a recent version of OSX, you have MAMP Pro 3 installed, and you’re using PHPStorm. There’s just one missing piece, for me, and that was how to handle symlinks in your plugins. I followed Michael Novotny’s post on this, and it almost works. This time I decided to document how I was able to get it working this time, so hopefully I don’t have suffer through this again. There’s always something that get’s me caught up and messed up. I’ve probably set it up, in various incarnations, close to 10 times. While true, it’s also one of the biggest pain in the asses to setup. Written by Peter Tasker Open source developer in Ottawa Ontario, Canada You should follow him on Twitter MAMP, Xdebug, PHPStorm and symlink madnessĪsk any PHP developer and they’ll tell you Xdebug is the best thing since sliced bread.