4.编译安装php,请配置好yum源(可以是本地系统光盘)后执行如下命令:
# yum -y groupinstall "X Software Development"
如果想让编译的php支持mcrypt扩展,此处还需要下载安装
libmcrypt-2.5.7-5.el5.i386.rpm
libmcrypt-devel-2.5.7-5.el5.i386.rpm
(可以在rpmfind.net找到,下载与平台好人操作系统对应的安装包)
(1)编译安装,这里以php-5.4.13为例
# tar xf php-5.4.13.tar.bz2
# cd php-5.4.13
# ./configure --prefix=/usr/local/php --with-MySQL=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2
# make
# make intall
(2)为php提供配置文件:
# cp php.ini-production /etc/php.ini
(3)vim /etc/httpd/httpd.conf
添加AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
修改为DirectoryIndex index.php index.html
5.安装xcache,为php加速:
(1)安装
# tar xf xcache-3.0.1.tar.gz
# cd xcache-3.0.1
# /usr/local/php/bin/phpize
# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config 准备好扩展进行编译
# make && make install
安装结束时,会出现类似如下行:
Installing sharedextensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
(2)编辑php.ini,整合php和xcache:
首先将xcache提供的样例配置导入php.ini
# mkdir /etc/php.d
# cp xcache.ini /etc/php.d
说明:xcache.ini文件在xcache的源码目录中。
接下来编辑/etc/php.d/xcache.ini,找到zend_extension开头的行,修改为如下行:
zend_extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so
注意:如果php.ini文件中有多条zend_extension指令行,要确保此新增的行排在第一位。
启用状态页面的方法很简单,只需要在主配置文件中添加如下内容即可:
vim /etc/htpd/httpd.conf
<Location /server-status>
SetHandler server-status
Require all granted
</Location>
Ok!这就完成啦
