下载必要资源
首先下载下列的源码包
libipeg – http://www.ijg.org/files/jpegsrc.v9.tar.gz
libpng – http://t.cn/zTgAx90
zlib – http://t.cn/zTVy3yu
freetype – http://t.cn/zTVyddP
gd – http://fossies.org/linux/www/gd-2.0.35.tar.gz
以上均可以wget
#安装jpeg库
#cd /usr/local
#mkdir {bin,include,lib,man,man1}
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9
./configure --prefix=/usr/local/jpeg
make
make install
#安装png库
#tar zxvf libpng-1.6.1.tar.gz
#cd libpng-1.6.1
#./configure --prefix=/usr/local/libpng
#make
#make install
#安装zlib
#tar zxvf zlib-1.2.7.tar.gz
#cd zlib-1.2.7
#./configure --prefix=/usr/local/zlib
#make
#make install
#安装FreeType
#tar zxvf freetype-2.4.11.tar.gz
#./configure --prefix=/usr/local/freetype
make
make install
#安装GD
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd --with-zlib=/usr/local/zlib/ --with-png=/usr/local/libpng/ --with-jpeg=/usr/local/jpeg/ --with-freetype=/usr/local/freetype/
#重新编译PHP并安装
#版本大家自定,下面的编译参数仅在php-5.3.23上通过...(以apache为列)
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd=/usr/local/gd/ --with-iconv --with-jpeg-dir=/usr/local/jpeg/ --with-zlib=/usr/local/zlib/ --enable-xml --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbstring=all --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-session --enable-imap --enable-calendar --enable-eaccelerator=shared --enable-wddx --with-mcrypt=/usr/local/libmcrypt/ --with-freetype-dir=/usr/local/freetype/ --without-pear
make
make install