Recompiling php5 with bundled gd lib support on debian etch
Today we're had a minor problem with the GD Lib. in PHP5-GD under Debian etch. The problem was that we've tried to you special functionality that is only available if you're using php own library. Instead of using the bundled library php provides the Debian and Ubuntu maintainers compile php5-gd package against the shared system library.
So what happens is that you're probably missing some extra functionality in your PHP gd calls for example there is no imagerotate() or imageantialias() functions. They are only available in the Bundled version that comes with PHP.
A typical error you get is this:
JpGraph Error The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.
But solving the problem thanks to debian is quite easy and only took some compile time. ;) To solve the problem I did the following steps:
Make sure your have you source package urls in apt sources.list defined simple check it by enter:
vi /etc/apt/sources.list
# A line like the following should appear
# source urls starting with deb-src for example:
deb-src http://ftp.de.debian.org/debian/ etch main contrib non-free
Next we're installing needed packages.
# Install build tools, debian helpers and fakeroot
apt-get install build-essential debhelper fakeroot
# source code should reside in /usr/src
cd /usr/src
# Download PHP source
apt-get source php5
# Install all packages required to build PHP5
apt-get build-dep php5
Now we're altering the build path for gdlib and make php to complile against the bundled gd lib version.
cd /usr/src/[PHP_VERSION]/debian # In my case php5-5.2.0
vi rules
# Next where changing gd lib compiler flag
# REPLACE: --with-gd=shared,/usr --enable-gd-native-ttf WITH: --with-gd=shared --enable-gd-native-ttf
# save and close
cd /usr/src/[PHP_VERSION]
dpkg-buildpackage -rfakeroot
# This takes a while
cd /usr/src
# Install new php5-gd lib package in my case:
dpkg -i php5-gd_5.2.0-8+etch13_amd64.deb
# Restart your apache or what every
/etc/init.d/apache2 restart
# Happy GD-ing :)
Permalink Kommentare[10] Tags: gd ubuntu imageantialias php building problem debian recompile gd2









Thank you very much for the information! I searched whole day how to make GDGraph works for my Lenny and you exactly pin-pointed the problem and the solution! But what to note is apart from using the customized php-gd package, I also need to replace the php-* packages with the customized packages to let it work.
Also, GDGraph (or maybe others) need to be compiled by tarball, but not pecl. The following is abstract:
wget http://pecl.php.net/get/gdchart-0.2.0.tgz > /tmp/gdchart-0.2.0.tgz
cd /tmp
tar xzvf gdchart-0.2.0.tgz
cd /tmp/gdchart-0.2.0
phpize
./configure
make
make install
After all it will not complain for the imageantialias error.
Keywords: Debian Lenny PHP GD GDGraph PECL imageantialias
Gesendet von dbp am Mai 26, 2009 at 05:51 PM MESZ #
Hi dbp,
your welcome!!
short notice I had a problem upgrading my lenny installation with php-gd imageantialias support due to a problem with the php-imap package.
Maybe its interesting for you / others. Then you can find the blog entry here: http://blog.pirsig.net/apiBlog/entry/php_compilation_error_debian_lenny
Gesendet von Alexander Pirsig am Mai 26, 2009 at 06:55 PM MESZ #
Thanks a lot for this very useful entry. I ran across the problem with the JPGraph libraries (although it was on Ubuntu Jaunty) and re-compilation solved it for me as well.
Gesendet von DerGrobe am Juni 10, 2009 at 12:49 PM MESZ #
Gesendet von Kernel#rand am August 03, 2009 at 01:23 AM MESZ #
I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Gesendet von ugg boots am Januar 13, 2010 at 02:53 AM MEZ #
Thank you...you saved my life ;)
Gesendet von roberto am März 04, 2010 at 05:16 PM MEZ #
It is my great pleasure to visit your website and to enjoy your excellent post here. I like that very much. I can feel that you paid much attention for those articles, as all of them make sense and are very useful. Thanks so much for sharing. I can be very good reader&listener discount cheap jordan shoes , if you are same searching for all to be good. Appreciate for your time! Happy New Year!
Gesendet von jordan shoes am März 19, 2010 at 03:05 AM MEZ #
Good read. There is currently quite a lot of information around this subject on the net and some are most defintely better than others. You have caught the detail here just right which makes for a refreshing change – thanks.
Gesendet von ???? am Juli 02, 2010 at 07:05 PM MESZ #
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can’t wait to read lots of your posts.
Gesendet von ???? am Juli 18, 2010 at 08:43 AM MESZ #
Great !!
I was trying to use ffmpeg-php to create thumbnails, and couldn't get it to work on my debian lenny with ispconfig.
Now everything works fine. THANKS !
Gesendet von LEE am Juli 23, 2010 at 10:23 AM MESZ #