Custom-compiled PHP with xdebug.so on OS X 10.5

Posted by tim on Apr 18th, 2009
2009
Apr 18

Had to screw around a bit today to get xdebug running on my development macbook pro.

I compile my own AMP stack from source, so my setup is a little different than most.

On my laptop, apache and php both live in /apache2, so my php binary is at /apache2/php/bin/php, and php.ini lives in /apache2/php/lib/php.ini

Here’s what I did to make xdebug work:

# cd /apache2/php/bin

# pecl install xdebug

Which gave me a shiny new xdebug.so in /apache2/php/lib/php/extensions/no-debug-non-zts-20060613

Pecl then lied to me, and said I should add “extension=xdebug.so” to my php.ini

That didn’t work.  I got message like:

PHP Warning:  PHP Startup: Unable to load dynamic library ‘./xdebug.so’ – (null) in Unknown on line 0

in apache’s error_log

What did work was adding the following line to php.ini, and restarting apache:

zend_extension=/apache2/php/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so

Now, this directly contradicts what my default php.ini said about not using directory information in the extension line, but fiddling with extension_dir didn’t seem to work for some reason.

Anyway, this worked for me.

Worth noting.  I still get some junk in apache’s error_log that looks like:

“Failed loading xdebug.so:  (null)”

but xdebug appears to be functioning properly (I get pretty-printed var_dumps, and the profiler will write cachegrind files just fine)

-->