Compiling PHP Extensions

There are lots of reasons why you might like to compile your own PHP extensions. For me those reasons are usually:

  • The extension isn’t available on pecl (e.g. uprofiler)
  • The extension is on pecl, but you need the newest version or a branch with a particular feature or fix in it, perhaps for testing
  • You are fixing an extension yourself (yay, we need more people like you!)

Related: If you followed my previous post on compiling PHP, be aware that in the php/bin/ folder there is a pecl binary that will install extensions correctly for whichever version of PHP it belongs to, so you may not need to read the rest of this post. However if you do, the paths follow on from the examples in that post.

I haven’t seen a really approachable guide anywhere, we tend to speak of extensions in hushed tones, and actually it isn’t particularly tricky so here is my quick how-to guide. Continue reading