How to compile PHP5 with GD

On January 30, 2011, in Ubuntu, by mike

In this how to you will learn to compile PHP5 With Bundled Support For GD On Ubuntu.

To install the required packages and download the source code for PHP5:

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
#cd php5-5.2.3
  • Now a package is compiled is set within the files contained in the debian directory of a package.
  • Rules for configuring the compile process can be found in debian/rules. In this file there is a line that reads –with-gd=shared,/usr –enable-gd-native-ttf \. This links to the Ubuntu distributed version of LibGD as a shared library.
  • It is part of the autoconf script that customises the compilation of PHP. We  replaced this line with –with-gd=shared –enable-gd-native-ttf \.
  • This causes the compilation process to use the bundled version of GD and make a shared library.

Once the package has been reconfigured it can be compiled and installed by:

Build the php5-* packages:

#dpkg-buildpackage -rfakeroot
#cd ..

Now let`s install the new php5-gd package

#dpkg -i php5-gd_5.2.3-1ubuntu6.3_i386.deb

 Quick restart
#/etc/init.d/apache2 restart

and hey presto, you should be using the bundled version of LibGD for PHP. Hurrah!

Tagged with:  

Leave a Reply

Free WordPress Themes

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Copyright © 2005-2010 Linux Server™. Use of this web site constitutes acceptance of the Linux Server™ Terms of Use and Privacy Policy. en-US Linux is a trademark registered by Linus Torvalds in the United States and other countries.