I'm a developer in Melbourne, Australia, and co-founder of Hello Code.

Published Sun 04 November 2007

← Home

How to add extensions to PHP 5 running as an Apache 2 module

Just a quick tip — hopefully this will help anyone having the same issue as I was. Our development server at work runs Ubuntu 6.10 (using the default Ubuntu LAMP setup), and this setup happens to use Apache 2, with PHP as an Apache module (rather than a CGI extension, or whatever).

Now this default setup doesn't include some fairly standard PHP extensions like cURL and the GD libraries — but working out how to get these included caused me no end of trouble. I didn't want to recompile PHP, but didn't understand why adding a reference to was giving me the error that it wasn't a valid PHP library. And surprise surprise, it's not; you need the PHP bindings. So for those who are in the same situation and don't want to recompile PHP, but need those extensions, there's actually a very simple solution that was incredibly hard to find on the web.

You can just install the packages from the repository.

So if you're a GUI person, you can use Synaptic and search for "php5" to retrieve the list of available modules. Or if you prefer the terminal, it's as easy as typing sudo apt-get install php5-gd or sudo apt-get install php5-curl.

I wish somebody had told me that.

To top