Thanks to a lead from Aaron Heimlich in the last post on my debugging attempt, I’ve got PHP debugging working on my Mac.

I made a short movie on how the debugger works (seen below) mostly because I wanted to use my fancy (read dorky) new title sequence :-D. First though, this is how you get the debugger setup.

You’ll need to download and install MAMP (an all-in-one Apache / PHP / MySQL application). MAMP stands for Macintosh, Apache, MySQL, and PHP if you didn’t guess. You can use MAMP’s distribution of Apache with the dbg.so without any problems.

After you have MAMP installed, follow the steps in the original post, but do not do sudo make install. Instead of make install, copy the dbg.so file (in the modules directory) into MAMP’s php4 extensions directory: /Applications/MAMP/bin/php4/lib/php/extensions/no-debug-non-zts-20020429 (from what I understand the current debugger does not work with php5). If you want, you can download the ones I compiled here. They are PPC only, and I offer no warrantee of any kind, etc etc.

Once you’ve copied the file, edit MAMPs php.ini file located in: /Applications/MAMP/conf/php4/php.ini. For reference, you’ll want to add the following lines in that file:

...
extension=dbg.so
...
[debugger]
debugger.enabled = true
debugger.profiler_enabled = true
debugger.JIT_host = clienthost
debugger.JIT_port = 7869

After you have the server setup, you’ll need the command line program as well. Again, follow the last post on how that needs to be done. If you have the Apple Developer tools installed, it shouldn’t cause you any troubles.

Once the command line application is ready, create a file called .dbgcli_init in your home directory and add the following lines (obviously using your project’s information where applicable):

set mode on
set mapurlroot http://192.168.1.200/
set mapremoteroot /Users/robrohan/Documents/workspace/MvCphp/
set maplocalroot /Users/robrohan/Documents/workspace/MvCphp/
set port 7869

You should be all set to debug after that. The following movie is an example of how to use the debugger and some basic commands that should get you started.

(One quick note, in the movie I said Apple didn’t include the headers and I meant symbols).