下载:
libmcrypt-2.5.8.tar.gz //加密算法扩展库
libpng-1.6.2.tar.gz //png图像库
gd-2.0.35.tar.gz //图形库
freetype-2.5.0.1.tar.bz2 //字体引擎
libxml2-2.7.8.tar.gz //xml的c语言版的解析器
jpegsrc.v9.tar.gz //jpeg的
libbmp-0.1.3.tar.bz2 //bmp图像的库
zlib-1.2.8.tar.gz //数据压缩用的函式库
--------------------------------------------------------------------
[root@centos ]# cd libxml2-2.7.8
[root@centos ]# ./configure --prefix=/usr/local/libxml2/
[root@centos ]# make && make install
[root@centos ]# cd zlib-1.2.8
[root@centos ]# ./configure --prefix=/usr/local/zlib/
[root@centos ]# make && make install
[root@centos ]# cd libpng-1.6.2
[root@centos ]#./configure --prefix=/usr/local/libpng/ --enable-shared
[root@centos ]# make && make install
------------------------------------------------------------------------------------
[root@centos ]# cd jpeg-9/
[root@centos ]# mkdir /usr/local/jpeg/
[root@centos ]# mkdir /usr/local/jpeg/bin/
[root@centos ]# mkdir /usr/local/jpeg/lib/
[root@centos ]# mkdir /usr/local/jpeg/include/
[root@centos ]# mkdir -p /usr/local/jpeg/man/man1
[root@centos ]# ./configure --prefix=/usr/local/jpeg/ --enable-shared --enable-static
[root@centos ]# make && make install
------------------------------------------------------------------------------------
[root@centos ]# cd freetype-2.4.6
[root@centos ]# ./configure --prefix=/usr/local/freetype/ --enable-shared
[root@centos ]# make && make install
------------------------------------------------------------------------------------
[root@centos]# cd gd-2.0.35
[root@centos ]# ./configure --prefix=/usr/local/gd/ --with-zlib=/usr/local/zlib/ \
--with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/libpng/ \
--with-freetype=/usr/local/freetype/
[root@centos ]# make && make install
------------------------------------------------------------------------------------
重新编译php
[root@centos ]# ./configure --prefix=/usr/local/php/\
--with-apxs2=/usr/local/apache/bin/apxs \
--with-libxml-dir=/usr/local/libxml2/ \
--with-jpeg-dir=/usr/local/jpeg/ \
--with-freetype-dir=/usr/local/freetype/ \
--with-gd-dir=/usr/local/gd/ \
--with-zlib-dir=/usr/local/zlib/ \
--with-mcrypt=/usr/local/libmcrypt/ \
--with-mysql=/usr/local/mysql/mysqldir \
--with-mysqli=/usr/local/mysql/mysqldir/bin/mysql_config \
--enable-soap \
--enable-mbstring=all \
--enable-sockets
[root@centos ]# make && make install
在http.conf里添加
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
================================================================================
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/usr/src/gd-2.0.35'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/gd-2.0.35'
make: *** [all] Error 2
# vim /usr/local/src/gd-2.0.35/gd_png.c
查找png.h改成 /usr/local/libpng/include/png.h
保存退出,再重新执行
================================================================================
onfigure: error: Cannot find MySQL header files under /usr/local/mysql/mysqldir/bin/mysql_config
Note that the MySQL client library is not bundled anymore.
解决:加 --with-mysqli=/usr/local/mysql/mysqldir/bin/mysql_config
================================================================================
================================================================================