Basically it involves like any other debugging solution a special PHP extension, while there is a commercial one from Zend (the makers of PHP) available, I wanted to give the "free" one - XDebug a try.
My problem (seems as always) is, that for OS X there are no binaries available and another problem is, that the Xdebug-extension depens on the used PHP version.
As I am using MAMP 1.7.2 for developing web applications on my Mac, I had to find either a binary or compile the source for myself.
There are already two guides available for installing/using Xdebug under OS X:
- Installing Xdebug on Mac OS X from Richard Warrender
- Setting up Xdebug on Mac OS X from Felix Geisendörfer
So I had to compile XDebug by myself, which turned out to be pretty easy.
The abovementioned PDF is pretty thorough in setting up XDebug and compiling it.
Simply download the latest source from http://www.xdebug.org , and put it into a folder. Open up terminal, change to that folder and follow the steps from the XDebug installation page.
If you have set up MAMP correctly, both phpize and php-config should be in your path.
After XDebug is compiled you should move it from "modules/xdebug.so" to your MAMP PHP5 Zend extension dir, which is for version 1.7.2: "/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/" (yes, one hell of a path).
Then, you just have to add the following lines to your php.ini (in /Applications/MAMP/conf/php5):
[xdebug]
zend_extension=/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/xdebug.so
All done? Not yet, the xdebug-extension won't load with Zend Optimizer enabled, so disable it form the PHP tab of the MAMP control panel and voilà, next time you restart your Apache it should say on the phpinfo() page, that Xdebug has been loaded!
If someone wants to have a xdebug-binary for MAMP 1.7.2 just drop me a line...