RedHat下安装并开启PHP GD库的方法
GD库是PHP进行图文操作时一个重要的库。红帽系统适合用编译安装。具体各步骤如下:
1、准备工作:
需要的软件分别为:zlib-1.2.7.tar,libpng-1.2.40.tar,jpeg-6b.tar,freetype-2.3.5.tar,gd-2.0.33.tar
打包下载地址:http://pan.baidu.com/share/link?shareid=452677&uk=3240790330
解压密码:d5475sf45ffdf54 (软件整理,转自璞玉POOY)
或者分类下载:
http://google-desktop-for-linux-mirror.googlecode.com/files/gd-2.0.35.tar.gz
http://down1.chinaunix.net/distfiles/jpegsrc.v6b.tar.gz
ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.2.tar.gz
http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz
http://down1.chinaunix.net/distfiles/freetype-1.3.1.tar.gz
http://down1.chinaunix.net/distfiles/gettext-0.16.1.tar.gz
2、安装zlib
tar xvzf zlib-1.2.3.tar.gzcd zlib-1.2.3./configure --prefix=/usr/local/zlibmake && make install
tar xvzf freetype-1.3.1.tar.gzcd freetype-1.3.1./configure --prefix=/usr/local/freetypemake && make install
tar xvzf libpng-1.5.2.tar.gzcd libpng-1.5.2./configure --prefix=/usr/local/libpng make && make install
tar xvzf jpegsrc.v6b.tar.gzcd jpegsrc.v6b./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-staticmake && make install
mkdir -p /usr/local/jpeg6/include/mkdir -p /usr/local/jpeg6/lib/mkdir -p /usr/local/jpeg6/bin/cjpegmkdir -p /usr/local/jpeg6/man/man1/
tar xvzf gettext-0.16.1.tar.gzcd gettext-0.16.1./configure --prefix=/usr/local/gettextmake && make install
tar xvzf gd-2.0.35.tar.gzcd gd-2.0.35./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local/libpng --with-freetype=/usr/local/freetypemake clean(之前编译过就要执行这句)makemake install
cd ../php-5.2.17/ext/gd/ # 下载的安装包所在目录/usr/local/php5/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd/ --with-freetype=/usr/local/freetype/make clean(之前编译过就要执行这句)make && make install
extension=gd.so
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --without-sqlite --without-pdo-sqlite --with-gd=/usr/local/gd --with-freetype-dir=/usr/local/freetype/make clean(之前编译过就要执行这句)makemake install
./httpd -k restart