Mac OS X + Eclipse + PDT + Xdebug + MAMP

12 Jan

Mac OS X + Eclipse + PDT + Xdebug + MAMP

in debug, Drupal, Drupal Planet, Drupal Planet, xdebug

I had written about setting up php debugging environment with Eclipse on windows.

Well, turns out, setting up the debug environment on Mac OS X is also a little tricky since the library files do not always work.

I used the Helios Eclipse PDT distribution. I tried using the Zend debugging environment. But after struggling with the settings in the php.ini file, I decided to try XDebug. XDebug is straightforward, once you have crossed the windy roads. 

Here is the main gottcha - the default xdebug.so which ships with MAMP server might not always work. xdebug.org does not have the mac os x distribution for the .so file either. The one that ships with komodo editor however works and you can get it from here. Once you download the right file, save it and note the location.

Next edit the php.ini located at /Applications/MAMP/conf/php5.3 - Add the following to it

 
zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.idekey=ECLIPSE_DBGP
 
 
Now if you run phpinfo(), you should get some output about xdebug. The basic debugging is setup.
Make sure your eclipse is configured to work with php5.3 and that it uses the xdebug.
Don't modify ini files or other setting for php5.2 or in the incorrect directory. This usually makes up for most errors.
 
You should be on your way to happily debug Drupal now.

copyright 2012 10jumps Llc.

copyright 2012 10jumps LLC.