PHP-FastCGI的配置和测试(linux下)
2014-09-30 17:20
169 查看
一、配置PHP-FastCGI
1、安装
wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
tar xzf mod_fastcgi-2.4.6.tar.gz
cd mod_fastcgi-2.4.6
cp Makefile.AP2 Makefile
make top_dir=/usr/local/apache
make top_dir=/usr/local/apache install
2、编辑httpd.conf配置文件,加入fastcgi模块装载代码:
LoadModule fastcgi_module modules/mod_fastcgi.so
3、配置apache支持php
编辑httpd.conf文件,加入如下代码:
### fastcgi ###
ScriptAlias /fcgi-bin/ "/usr/local/php/bin/"
AddHandler php-fastcgi .php
Action php-fastcgi /fcgi-bin/php-cgi
AddType application/x-httpd-php .php
<IfModule mod_fcgid.c>
AddHandler fcgid-script. .php .fcgi ### 暂时只配置支持.php
IdleTimeout 300
ProcessLifeTime 1800
MaxProcessCount 100
DefaultMinClassProcessCount 3
DefaultMaxClassProcessCount 8
IPCConnectTimeout 15
IPCCommTimeout 300
MaxRequestsPerProcess 100
</IfModule>
### fastcgi ###
4、编辑httpd.conf文件,建立虚拟主机可以这样配置:
<VirtualHost *:80>
DocumentRoot /usr/local/apache/htdocs
ServerName localhost
Options +ExecCGI
AddHandler fastcgi-script .fcgi
AddType application/x-httpd-php .php
Action application/x-httpd-php /fcgi-bin/php-cgi
<Directory /usr/local/apache/htdocs>
Options Indexes ExecCGI
Order allow,deny
allow from all
</Directory>
</VirtualHost>
二、压力测试
500人总共请求5000次,命令如下:
/usr/local/apache/bin/ab -c 500 -n 5000 http://localhost/index.php
以下为配置了PHP-FastCGI的测试结果:
以下为未配置PHP-FastCGI的测试结果:
三、总结
PHP-FastCGI的性能效果还是挺显著的。。
1、安装
wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
tar xzf mod_fastcgi-2.4.6.tar.gz
cd mod_fastcgi-2.4.6
cp Makefile.AP2 Makefile
make top_dir=/usr/local/apache
make top_dir=/usr/local/apache install
2、编辑httpd.conf配置文件,加入fastcgi模块装载代码:
LoadModule fastcgi_module modules/mod_fastcgi.so
3、配置apache支持php
编辑httpd.conf文件,加入如下代码:
### fastcgi ###
ScriptAlias /fcgi-bin/ "/usr/local/php/bin/"
AddHandler php-fastcgi .php
Action php-fastcgi /fcgi-bin/php-cgi
AddType application/x-httpd-php .php
<IfModule mod_fcgid.c>
AddHandler fcgid-script. .php .fcgi ### 暂时只配置支持.php
IdleTimeout 300
ProcessLifeTime 1800
MaxProcessCount 100
DefaultMinClassProcessCount 3
DefaultMaxClassProcessCount 8
IPCConnectTimeout 15
IPCCommTimeout 300
MaxRequestsPerProcess 100
</IfModule>
### fastcgi ###
4、编辑httpd.conf文件,建立虚拟主机可以这样配置:
<VirtualHost *:80>
DocumentRoot /usr/local/apache/htdocs
ServerName localhost
Options +ExecCGI
AddHandler fastcgi-script .fcgi
AddType application/x-httpd-php .php
Action application/x-httpd-php /fcgi-bin/php-cgi
<Directory /usr/local/apache/htdocs>
Options Indexes ExecCGI
Order allow,deny
allow from all
</Directory>
</VirtualHost>
二、压力测试
500人总共请求5000次,命令如下:
/usr/local/apache/bin/ab -c 500 -n 5000 http://localhost/index.php
以下为配置了PHP-FastCGI的测试结果:
以下为未配置PHP-FastCGI的测试结果:
三、总结
PHP-FastCGI的性能效果还是挺显著的。。
相关文章推荐
- Apache 配置------FastCGI方式使用PHP(包含:linux下编译安装fmod_fcgid,配置apache以支持FastCGI)
- LNMP(linux+nginx+mysql+php)源码安装及协调配置测试笔记
- linux后台服务器开发环境部署配置和验证(nginx+apache+php-fpm+FASTCGI(C/C++))
- [Linux] Ubuntu_9.04_server安装nginx+php(fastcgi)+nginx虚拟主机配置格式
- Fedora 7(Linux)下 Apache+PHP+MySQL+Subversion 开发测试环境配置过程
- 安装配置Linux+lighttpd+mysql+PHP(FastCGI)
- linux后台server开发环境的部署配置和验证(nginx+apache+php-fpm+FASTCGI(C/C++))
- linux下面配置sendmail邮件服务器,并用php mail函数发送邮件测试
- fastcgi+apache+php的配置
- Linux+Apache+MySQL+PHP的安装与配置
- linux下apache+php配置
- Linux+Apache+PHP+MySQL+SSL配置详解
- linux网络配置、测试及故障诊断方法和工具三
- php连接mysql测试和配置
- Linux+Apache+Mysql+PHP典型配置
- linux下安装apache与php;Apache+PHP+MySQL配置攻略
- Linux下PHP+MYSQL+APACHE配置过程 (摘)第1/2页
- Linux+Apache+Mysql+PHP典型配置
- Linux+Apache+Mysql+PHP典型配置
- LINUX/APACHE/MYSQL/PHP服务器配置