Installing GD 1.3 for PHP on Linux
by Nathan Wallace
(Oct 25, 1999)
This document describes the installation of the GD graphics library on Linux for use with PHP. We are using an old version of this library since newer versions do not allow the generation of gif files due to patent problems.
I've assumed that you have Apache and PHP installed in /usr/local/etc/php as per my instructions.
- You need to be working as root to install gd.
- I like to keep a copy of my downloaded programs in
So create this directory if you don't already have one.
- You can download GD from here.
- Save the file as:
using these commands:
- First we have to unpack the download. We are going to install it into /usr/local/gd1.3. I've used a pretty cryptic tar command below to do it all in one hit.
tar xzf gd1.3.tar.gz -C ..
- Let's make the GD stuff easy to find:
ln -s gd1.3 gd
- Now we need to compile everything:
Checking it Worked
- You can run the gddemo program to check that the installation is working:
- This demo program generates a gif file:
which you can look at in your browser by downloading it from your server or calling up the file directory.
Adding GD Support to PHP
- Jump into the php installation directory:
- We need to configure PHP to use GD. You should just use the configure command that you used last time and add --with-gd=/usr/local/gd to it. If you followed my instructions for installing PHP with MySQL then your configure command will look like this:
./configure --with-apache=../httpd --with-mysql=/usr/local/mysql --enable-track-vars --with-gd=/usr/local/gd
- Make the new PHP library:
- Now we have to remake apache to use the new PHP: