Skip to content

Herman J. Radtke III

Tag: #gdb

Building php pecl extensions

My last post I explained how to efficiently checkout the php svn repository.  Now we need to start building pecl extensions and even php itself.  I prefer to use Cent OS for my linux needs and naturally use rpm's to track all my packages.  This means I have a stable version of php installed with all the various extensions that I could want.  Rather than messing with this stable version, I am going to build a custom debug build of php in /usr/local.  I say "debug", because this build of php will use the --enable-debug option to allow easy debugging using gdb.  Since I am doing pecl extension development, I don't want to build the trunk version of php.  I want to build my pecl extensions against the most recent stable version of php to isolate environmental issues as much as possible.

PHP extension debugging hack

At work I maintain a handful of custom PHP extensions.  When someone reports a problem with one of the extensions, I want to fire up gdb right away and see exactly what is going on.  In order to do this, I build a custom php binary with debugging enabled.  I leave this binary inside my home directory so as not to affect my installed production php binary.  I should now be able to rebuild my custom extensions now with debugging enabled and start debugging.  But wait, the configure script rejects the flag.