分类:
2009-08-10 02:41:33
1. 安装zlib (安装libpng和gd前需要先安装zlib),下载地址:
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure
# make;make install
注:centos5.3自带此版本,可以不用安装yum list all|grep zlib查看
2. 安装libpng,下载地址:
# tar zxvf libpng-1.2.38.tar.gz
# cd libpng-1.2.38
# ./configure --prefix=/usr/local/libpng
# make test
# make install
3. 安装freetype,下载地址:
# tar zxvf freetype-2.3.9.tar.gz
# cd freetype-2.3.9
# ./configure --prefix=/usr/local/freetype
# make;make install
4. 安装jpeg7,下载地址:
# tar zxvf jpegsrc.v7.tar.gz
# cd jpeg-7
# ./configure --prefix=/usr/local/jpeg7
# make;make install
5. 安装fontconfig,下载地址:
# tar xzvf fontconfig-2.7.3.tar.gz
# cd fontconfig-2.7.3
# ./configure --with-freetype-config=/usr/local/freetype/bin/freetype-config --prefix=/usr/local/fontconfig
# make;make install
6. 安装gd,下载地址:
# tar zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg7/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/ --with-fontconfig=/usr/local/fontconfig/
//编译过程中会看到如下信息
** Configuration summary for gd 2.0.35:
Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: no
Support for pthreads: yes
//可以看到png 、 jpeg 、 freetype都已经安装上了
# make
# make install
7. 正式安装php,下载地址:
# tar xzvf php-5.2.11.tar.gz
# cd php-5.2.11
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg7/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd/ --enable-mbstring --with-mcrypt=/usr/include/
####################################################################################
参数说明:
--with-mcrypt[=DIR] Include mcrypt support
注:
在编译gd的时候png报错:
gd_png.c:791: syntax error before "for"
gd_png.c:793: warning: parameter names (without types) in function declaration
gd_png.c:793: warning: da
gd_png.c:794: syntax error before '}' token
gd_png.c:798: warning: parameter names (without types) in function declaration
gd_png.c:798: warning: da
gd_png.c:799: syntax error before '}' token
gd_png.c:802: syntax error before '&' token
gd_png.c:802: warning: da
gd_png.c:404: storage size of `open' isn't known
[color=Red]make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/tmp/gd-2.0.26gif'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gd-2.0.26gif'
make: *** [all] Error 2
解決方法为:
vi gd_png.c
找到「png.h」改成「/usr/local/libpng2/include/png.h」)