天天看點

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壓力工具測試