Rants and musings of Paul Scott
Paul Scott on 2010-12-18 17:35:40PHP GD and Ubuntu
It seems that the maintainers over at Ubuntu regard the PHP5 bundled GD version a fork of Boutells GD library (I understand why) and that forks = security risks (again, the logic is there). However, I am working on an application that requires a higher level of GD functions than the "older" GD library provides, chief amongst them the imageantialias() function (amongst others).
The only recourse was to recompile PHP, build a php5-gd package from that and then replace the current php5-gd deb with the new one. Luckily if you link against the standard system GD library (not the PHP shared lib) you get the full deal!
Sounds simple enough, and so it is! Here are the steps required:
1. Completely remove your old php5-gd with an:
apt-get remove --purge php5-gd
2. You then need a fakeroot and build environment (if you don't already have one) so install that with the following:
# Install build tools, debian helpers and fakeroot
apt-get install build-essential debhelper fakeroot
# source code should reside in /usr/src
# Download PHP source
apt-get source php5
# Install all packages required to build PHP5
apt-get build-dep php5
3. Next up we have to modify the debian rules as to how the package is compiled. All that you need to do here is to open up the debian/rules file in your favourite text editor and find the line that looks like:
and replace it with:
4. You can then go ahead and rebuild the deb with the following:
# build the php5-* packages
# Install the new php5-gd package
dpkg -i php5-gd_5.3.2-1ubuntu4.5_i386.deb
5. Restart apache with
/etc/init.d/apache2 force-reloadand you should be smiling!
That's it. Told you it would be simple!