天天看点

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

一:安装PHP:

将php安装包和libmcrypt-devel开发包上传到安装的机器

1、安装libmcrypt-devel和bzip2解决依赖环境:

[root@localhost php-5.4.26]# yum localinstall /tmp/libmcrypt-*

[root@localhost php-5.4.26]# yum install bzip2*

2、解压php-5.4.26并编译安装

[root@localhost ~]# tar xvf php-5.4.26.tar.gz

[root@localhost ~]# cd php-5.4.26

开始编译:

./configure --prefix=/opt/php--with-config-file-path=/opt/php/etc--with-config-file-scan-dir=/opt/php/etc/conf.d --enable-fpm--with-fpm-user=www --with-fpm-group=www --with-pear --with-curl --with-gd--with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv --with-mcrypt--with-mhash --with-zlib --with-xmlrpc --with-xsl --with-openssl --with-mysql--with-mysqli --with-pdo-mysql --disable-debug --enable-zip --enable-sockets--enable-soap --enable-mbstring --enable-magic-quotes --enable-inline-optimization--enable-memory-limit --enable-xml --enable-ftp --enable-exif --enable-wddx--enable-bcmath --enable-calendar --enable-sqlite-utf8 --enable-shmop--enable-dba --enable-sysvsem --enable-sysvshm --enable-sysvmsg

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

编译完成:

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

安装并验证:

[root@localhost php-5.4.26]# make && make install

[root@localhost php-5.4.26]# ls  /usr/local/php/

bin  etc  include  lib  php

3、编辑http配置文件支持php:

 确认http的配置文件已经添加

[root@localhost php-5.4.26]# vim  /etc/httpd2/httpd.conf

151 LoadModule php5_module        modules/libphp5.so

添加配置文件:

[root@localhost php-5.4.26]# cp php.ini-development  /etc/php.ini

添加php类型支持:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

添加支持http首页:

5、编辑php首页并测试:

[root@localhost php-5.4.26]# cd  /usr/local/apache/htdocs/

[root@localhost htdocs]# vim index.php

<?php

        phpinfo();

?>

重启apache:

[root@localhost php-5.4.26]# /etc/init.d/httpd2  restart

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

二:安装phpMyadmin并测试:

安装简单,直接解压后移动到apache工作目录即可:

[root@localhost ~]# unzip phpMyAdmin-4.0.5-all-languages.zip

[root@localhost ~]# mv phpMyAdmin-4.0.5-all-languages  /usr/local/apache/htdocs/pma

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试
Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

三:安装xcache并测试:

[root@localhost ~]# tar xvf xcache-3.0.3.tar.bz2

[root@localhost ~]# cd xcache-3.0.3

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

编译和安装:

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

[root@localhost xcache-3.0.3]# mkdir /etc/php.d

[root@localhost xcache-3.0.3]# cp xcache.ini  /etc/php.d/

[root@localhost xcache-3.0.3]# vim /etc/php.d/xcache.ini

    extension=/usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so

[root@localhost xcache-3.0.3]# /etc/init.d/httpd2  restart

测试:

用户浏览器打开主机地址:

查看xcache信息:

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

查看MySQL信息:

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试

四:ab压力性能测试工具:

ab测试工具常用的选项:

-n:要测试的连接总数,即测试连接多少次

-c:每次测试连接的并发数目

测试之前要使用ulimit取消或增大里连接数限制,默认是1024;

Fast-Cgi模式编译安装php-5.4.26、Xcache和MysqlAdmin、ab压力工具测试