源码安装PHP5.3.0
时间:2009-08-10 来源:butting
1. 安装zlib (安装libpng和gd前需要先安装zlib),下载地址:http://down.itlearner.com/soft/2359.shtml
# 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,下载地址:http://www.libpng.org/pub/png/libpng.html
# tar zxvf libpng-1.2.38.tar.gz
# cd libpng-1.2.38
# ./configure --prefix=/usr/local/libpng
# make test
# make install
3. 安装freetype,下载地址:http://ftp.twaren.net/Unix/NonGNU/freetype/
# tar zxvf freetype-2.3.9.tar.gz
# cd freetype-2.3.9
# ./configure --prefix=/usr/local/freetype
# make;make install
4. 安装jpeg7,下载地址:http://www.ijg.org/
# tar zxvf jpegsrc.v7.tar.gz
# cd jpeg-7
# ./configure --prefix=/usr/local/jpeg7
# make;make install
5. 安装gd,下载地址:http://www.libgd.org/releases/
# 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/
//编译过程中会看到如下信息
** 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
6. 正式安装php
# tar xzvf php-5.3.0.tar.gz
# cd php-5.3.0
# ./configure --prefix=/usr/local/php5 --with-apxs2=/home/service/http/apache2/bin/apxs --with-mysql=/home/service/database/mysql5/ --with-gd=/usr/local/gd/ --with-zlib --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg7/ --with-freetype-dir=/usr/local/freetype/ --enable-mbstring --with-mcrypt=/
####################################################################################
参数说明:
--enable-mbstring Enable multibyte string support
--with-mcrypt[=DIR] Include mcrypt support
7.整合php,mysql和apache
cp php.ini-dist /usr/local/php5/lib/php.ini
vi /usr/local/php5/lib/php.ini
将extension=php_mysql.dll前面的;去掉
vi /etc/httpd.conf
添加以下两行
AddType application/x-httpd-php php .phtml
AddTypeapplication/x-httpd-php-source .phps
8. 安装ZendOptimizer,下载地址:http://www.zend.com/en/products/guard/downloads
# tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
# cd ZZendOptimizer-3.3.3-linux-glibc23-i386
# ./install.sh