Posted 11/23/2009 - 15:18 by State68
Earlier this year I needed to make a bit of money so I developed a database app in Filemaker. In many ways I found it a real pain to use - selecting each line of the code you want to write from a clickable list is far from ideal - but its limitations meant that debugging was really straightforward: use the built-in step-through debugger, follow everything through, find the bug, fix it.
Going back to Drupal and PHP development after using Filemaker was great in terms of speed, efficiency and flexibility, but I really missed that step-through debugging. I knew that this was available in weighty IDEs like Eclipse, but I'm a big fan of TextMate and wanted to stay with it.
- Download and install XAMPP. Note that this is XAMPP version 1.0.1, the last version of XAMPP - as far as I know - that used PHP 5.2.9. Later versions use PHP 5.3, which is not yet compatible with Drupal.
- Download the latest XDebug binaries from here. You need the Mac OS X version of the PHP Remote Debugging package.
- Decompress the XDebug binaries. You'll end up with a folder called something "like Komodo-PHPRemoteDebugging-5.2.2-35694-macosx". In that folder there are a few subfolders; pick the subfolder that corresponds to the version of PHP you are going to be running - 5.2 if you've installed XAMPP 1.0.1.
- In that folder there is a file called xdebug.so. This needs to be copied to your XAMPP extensions folder, which will be somewhere like /Applications/XAMPP/xamppfiles/lib/php/php-5.2.9/extensions/no-debug-non-zts-20060613.
- Now you need to tell XAMPP that the XDebug extension has been installed. To do this, edit php.ini which should be in /Applications/XAMPP/etc. Add the following lines to the bottom of the file:
xdebug.remote_enable = On
xdebug.remote_autostart = 1
You might have to fine-tune this to get the paths absolutely right.
- Download and install MacGDBp from here.
- You're good to go: run MacGDBp, and then load any PHP file that's on your XAMPP server - MacGDBP will step through it, and let you set breakpoints.