PHP5.2 with Bundled GD on Debian

  Debian not using gd bundled with php5. More info available at:

Here is the simple guide how to build your own php5-gd module (with bundled GD).


Install needed tools:

apt-get install build-essential debhelper fakeroot


Go to the source directory:

cd /usr/src


Now donload the sourcode of PHP:

apt-get source php5


Install packages needed by PHP5 build process:

apt-get build-dep php5


Go to the source directory

cd php5-5.2.6.dfsg.1

Edit the file: debian/rules

Find the line containing:"--with-gd=shared,/usr --enable-gd-native-ttf" and edit it so that ",/usr" is removed. After that it should look like:

"--with-gd=shared --enable-gd-native-ttf"

Now build the package:

dpkg-buildpackage -rfakeroot


Now go one directory up and install the package:

cd ..

dpkg -i php5-gd_5.2.6.dfsg.1-1+lenny10_i386.deb

Reload apache2:

/etc/init.d/apache2 restart