MAMP + Xdebug + Lion
In Part 1 of my MAMP + Lion series, I set up my MAMP installation so that I could use the included PECL installer. Then we installed OAuth. In Part 2, we installed MacPorts, then used PECL to install the ImageMagick “Imagick” extension. I decided to give you a breather and make this piece much simpler, so we’re going to install Xdebug. Originally this post was much longer since I didn’t think about checking for Xdebug until after I had already done a PECL install of the software. Perhaps in previous versions of MAMP this was a requirement, but with MAMP 2, the Xdebug extension has already been compiled. You just need to enable it.
To enable Xdebug, we need to edit the php.ini file. In this file, we need to uncomment the following line:
And add the following two lines to enable an IDE or stand-alone application access to Xdebug:
With these changes made, just restart the apache process and Xdebug should be enabled. Simple, right?
The Xdebug GUI
I use PHPStorm as my IDE and it comes with a nice zero-configuration Xdebug set up. Basically, I just tell the application to start listening on my localhost. If you want to use a decent free application, there is MacGDBp. Just download and install and you should be good to go. See, I told you this piece would be simple! In part 4, we’ll get back into the terminal and install PHPUnit.