安装gd需要以下库:

gd-2.0.33.tar.gz   http://www.boutell.com/gd/
jpegsrc.v6b.tar.gz   http://www.ijg.org/
libpng-1.2.7.tar.tar   http://sourceforge.net/projects/libpng/
zlib-1.2.2.tar.gz   http://sourceforge.net/projects/zlib/

freetype-2.1.9.tar.gz  http://sourceforge.net/projects/freetype/

1、安装 zlib  - zlib-1.2.8.tar.gz

wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gz

tar -zxf zlib-1.2.3.tar.gz

cd zlib-1.2.3

./configure --prefix=/usr/local/zlib

make

make install

2、安装 jpeg - 我用的是 jpegsrc.v9.tar.gz

wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg.tar.gz

安装前先创建jpeg安装文件所需(如下)目录,防止提示类似“无法创建一般文件‘/usr/local/jpeg/***’: 没有那个文件或目录" 的错误

(此处插入提示:本人用root账号安装时未出现此情况)

mkdir /usr/local/jpeg

mkdir  /usr/local/jpeg/bin

mkdir  /usr/local/jpeg/lib

mkdir  /usr/local/jpeg/include

mkdir  /usr/local/jpeg/man

mkdir  /usr/local/jpeg/man1

mkdir  /usr/local/jpeg/man/man1

tar -zxf jpeg.tar.gz

cd jpeg-6b

./configure --prefix=/usr/local/jpeg --enable-shared --enable-static

make

make install

3、安装 libpng  - 我用的是 libpng-1.6.9

wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gz

tar -zxf libpng-1.2.16.tar.gz

cd libpng-1.2.16

4、安装 freetype  --安装此包需要 libpng库依赖,安到默认位置 我用的是 freetype-2.5.1

wget http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gz

tar -zxf freetype-2.3.4.tar.gz

cd freetype-2.3.4

mkdir -p /usr/local/freetype

./configure --prefix=/usr/local/freetype

make

make install

5、安装 GD -- 我用的是 libgd-2.1.0.tar.gz

wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/gd-2.0.33.tar.gz

tar -zxf gd-2.0.33.tar.gz

cd gd-2.0.33

./configure --prefix=/home/www/thirdlib/gd2 --with-jpeg=/home/www/thirdlib/jpeg/  --with-zlib=/home/www/thirdlib/zlib/ --with-png=/home/www/thirdlib/libpng --with-freetype=/home/www/thirdlib/freetype/

用默认安装路径的话:

./configure --with-jpeg=/usr --with-zlib=/usr --with-png=/usr --with-freetype=/usr

make

make install

last :php安装gd

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --enable-ftp --enable-sockets --with-gd=/usr/local/gd2 --enable-gd-native-ttf --with-ttf --enable-magic-quotes --with-iconv -enable-mbstring=all

OK 全部完成

PS:如果安装有报错:

configure.ac:64: error: possibly undefined macro: AM_ICONV

If this token and others are legitimate, please use m4_pattern_allow.

See the Autoconf documentation.

make: *** [configure] Error 1

需要安装gettext 这里下载

./configure --prefix=/usr/local/libpng

make

make install

05-26 13:48