Rebuilding php5-cgi for GD Functionality
by Jiang Yio on Jan.30, 2008, under Computing
I dug up some old code from last summer. It was a PHP-based AJAX photomanipulator. Well, I decided to move it off free hosting and put it on my dedicated Debian dev server, so I could feel physically closer to it.
It didn’t work. Well, parts of it. The reason was that the php5-gd package I used didn’t provide the imagefilter and imageconvolute functions. So I set off to rebuild php5-cgi, with the statically-linked version of GD that does provide these functions. Here we go:
apt get update && apt get upgrade
cd /usr/src
apt-get source php5-cgi
apt-get build-dep php5-cgi
cd php5-5.2.0
Okay, so we now have the source package. The configuration should be edited to indicate that we want statically-linked GD. Any text editor should do.
nano debian/rules
Change all instances of --with-gd=shared,… to --with-gd. Also add --with-gd --enable-gd-native-ttf to the configure-cgi-stamp: patch-stamp section. Now we save the files and start the build process.
./debian/rules binary
This takes a while. When it’s done, there should be some new debs in the parent directory. Let’s install them.
dpkg -i php5-cgi_5.2.0-8+etch7_i386.deb
At this point, the Web server should be restarted.