GD library compile from source: Debian Lenny

Written by Peter Davies on .

It appears that various useulf functions, that my php applications need require you to compile the GD library from source. The steps below outline this procedure:

cd /usr/src
ls -al

apt-get source php5-gd
apt-get build-dep php5-gd
cd php5-5.2.6.dfsg.1/
nano debian/rules

cd php5-5.2.6.dfsg.1/
nano debian/rules

edit the line where it says:

gd=shared,/usr --enable-gd-native-ttf
change to
gd=shared --enable-gd-native-ttf

Then you need to compile the code and replace your existing module with the newly created one:

mv /usr/lib/php5/20060613/ /usr/lib/php5/20060613/
cp /usr/src/php5-5.2.6.dfsg.1/apache2-build/modules/ /usr/lib/php5/20060613/

It's then usually advisable to restart apache so that you can see the changes.