linux中升级php和GD库笔记
php-5.1.2.tar.gz
安装php所需的软件包
(其中libxml2是安装php5必须的,为什么还需要perl呆会说明原因。)
libxml2-2.6.19.tar.gz
libxslt-1.1.15.tar.gz
ActivePerl-5.8.8.817-i686-linux-2.2.17-gcc-257965.rpm
curl-7.15.0.tar.gz
GD库所需要软件包
(有人说PHP源码包里自带了GD2.0.28和zlib,
只要安装GD的三个支持包:jpg,png和freetype,但是我们还是下载)
gd-2.0.33.tar.gz
freetype-2.1.10.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.gz
zlib-1.2.3.tar.gz
//安装jpeg
[root@as4 local]# mkdir -p /home/servers/jpeg6
[root@as4 local]# mkdir -p /home/servers/jpeg6/bin
[root@as4 local]# mkdir -p /home/servers/jpeg6/lib
[root@as4 local]# mkdir -p /home/servers/jpeg6/include
[root@as4 local]# mkdir -p /home/servers/jpeg6/man
[root@as4 local]# mkdir -p /home/servers/jpeg6/man1
[root@as4 local]# mkdir -p /home/servers/jpeg6/man/man1
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/home/servers/jpeg6/ --enable-shared --enable-static
# make; make install
b.安装libpng
# cd ..
# tar -zvxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install
c.安装 freetype
# cd ..
# tar -zvxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# mkdir -p /home/servers/freetype
# ./configure --prefix=/home/servers/freetype
# make;make install
d.:安装zlib
# cd ..
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib.1.2.3
# ./configure
# make;make install
e.安装GD库
# cd ..
# tar -zvxf gd-2.0.33.tar.gz
# mkdir -p /home/servers/gd2
# cd gd-2.0.33
# ./configure --prefix=/home/servers/gd2 --with-jpeg=/home/servers/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/lib/ --with-freetype=/home/servers/freetype/
# make; make install
e.安装Curl库
# cd ..
# tar -zxvf curl-7.15.0.tar.gz
# mkdir -p /home/servers/curl
# ./configure --prefix=/home/servers/curl
# make; make install
五:安装php5,php5必须有libxml2支持!
a.安装libxml2
# cd ..
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /home/servers/libxml2
# ./configure --prefix=/home/servers/libxml2
# make; make install
b.安装 libxslt(可选安装,你可以不安装)
# cd ..
# tar -zxf libxslt-1.1.15.tar.gz
# mkdir -p /home/servers/libxslt
# cd libxslt-1.1.15
# ./configure --prefix=/home/servers/libxslt --with-libxml-prefix=/home/servers/libxml2
# make; make install
c.安装php5
# cd ..
# tar -zvxf php-5.1.2.tar.gz
# mkdir -p /usr/local/php
# cd php-5.05
# ./configure --prefix=/home/servers/php5 --with-apxs2=/home/servers/apache/bin/apxs --with-mysql=/home/servers/mysql522 --with-curl=/home/servers/curl --enable-ftp --with-libxml-dir=/home/servers/libxml2 --with-expat-dir=/usr/lib --enable-soap --with-gd=/home/servers/gd2/ --with-jpeg-dir=/home/servers/jpeg6/ --with-zlib-dir=/usr/local/lib/ --with-png=/usr/local/lib/ --with-freetype-dir=/home/servers/freetype/
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini (别忘记了呵呵)
在PHP5.2的编译的过程中,如果遇到
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient_r under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!
那么,你需要注意了,你可能在编译APACHE的时候,使用--with-mpm模块,请在编译MYSQL的时候加上 --enable-thread-safe-client.
这是PHP5.2的一个改进,在PHP5.2.0之前的版本都不需要MYSQL启用安全线程。