分类: 系统运维
2011-07-11 17:53:03
1.安装GD库(让PHP支持GIF,PNG,JPEG)---安装 jpeg8
# mkdir -p /usr/local/jpeg8
# mkdir -p /usr/local/jpeg8/bin
# mkdir -p /usr/local/jpeg8/lib
# mkdir -p /usr/local/jpeg8/include
# mkdir -p /usr/local/jpeg8/man
# mkdir -p /usr/local/jpeg8/man1
# mkdir -p /usr/local/jpeg8/man/man1
# tar -zxvf jpegsrc.v8b.tar.gz
# cd jpeg-8b
# ./configure --prefix=/usr/local/jpeg8/ --enable-shared --enable-static
# make; make install
2.安装GD库---安装libpng
# tar -zvxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# ./configure --disable-shared --prefix=/usr/local/libpng
# make; make install
3.安装GD库---安装 freetype
# tar -zvxf freetype-2.2.1.tar.gz
# cd freetype-2.2.1
# ./configure --prefix=/usr/local/freetype
# make;make install
4.安装GD库---安装zlib
# tar -zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/usr/local/zlib
# make;make install
5.安装GD库
# tar -zvxf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/libpng/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/
# make; make install
重新编译PHP
进入PHP安装目录
# cd php-5.2.6
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-zlib-dir=/usr/local/zlib --with-iconv=/usr/lib --enable-mbstring --enable-ftp --with-curl=/usr/local/curl --with-libxml-dir=/usr/local/libxml2 --with-gettext --with-kerberos --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd2/ --with-freetype-dir=/usr/local/freetype
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
其中./configure 后的
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2
是必要的选项
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg8/
--with-png=/usr/local/lib
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项