php5.3.3已经内置了php-fpm(之前是patch的形式),编译的时候,设置以下参数就可以了
–enable-fpm
---------------------------------------------------
安装php 5.3.3(5.3.3已包括fpm):
wget http://cn.php.net/get/php-5.3.3.tar.bz2/from/this/mirror
tar -jxvf php-5.3.3.tar.bz2
cd php-5.3.3
./configure --prefix=/usr/home/yaoya/php --enable-fpm
make
make install
配置php:
cp php.ini-development /usr/home/yaoya/php/lib/php.ini
cd /usr/home/yaoya/php/etc
cp php-fpm.conf.default php-fpm.conf
编辑php-fpm.conf
[global]
pid = /usr/home/yaoya/php/var/run/php-fpm.pid
error_log = /usr/home/yaoya/php/var/log/php-fpm.log
log_level = notice
[www]
listen = 127.0.0.1:9000
user = yaoya
group = yaoya
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
启动php fastcgi:
/usr/home/yaoya/php/sbin/php-fpm
安装nginx 0.7.67:
wget http://nginx.org/download/nginx-0.7.67.tar.gz
cd nginx-0.7.67
./configure --prefix=/usr/home/yaoya/nginx
make
make install
配置nginx(nginx.conf):
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/home/yaoya/nginx/html/scripts$fastcgi_script_name;
include fastcgi_params;
}
启动nginx:
/usr/home/yaoya/nginx/sbin/nginx
使用ab进行压力测试,和apache2对比:(100000次)
100并发:
apache html(1k):12455.30
nginx html(1k):15127.89
apache php(phpinfo):1158.29
nginx php(phpinfo):3759.40
500并发:
apache html(1k):7884.27
nginx html(1k):16394.00
apache php(phpinfo):1181.46
nginx php(phpinfo):3542.59
结论nginx和apache在默认设置下单台处理性能比约为3:1。
PHP 5.3.3的php-fpm比PHP 5.2.13的php-cgi占用内存小多了。很期待PHP 5.3.3的表现。
来源:http://yaoya.org/wp/index.php/post/93
http://syre.blogbus.com/logs/20092011.html
估计今后的配置:nginx0.8.50 + php3.3.3 + mysql
–enable-fpm
---------------------------------------------------
安装php 5.3.3(5.3.3已包括fpm):
wget http://cn.php.net/get/php-5.3.3.tar.bz2/from/this/mirror
tar -jxvf php-5.3.3.tar.bz2
cd php-5.3.3
./configure --prefix=/usr/home/yaoya/php --enable-fpm
make
make install
配置php:
cp php.ini-development /usr/home/yaoya/php/lib/php.ini
cd /usr/home/yaoya/php/etc
cp php-fpm.conf.default php-fpm.conf
编辑php-fpm.conf
[global]
pid = /usr/home/yaoya/php/var/run/php-fpm.pid
error_log = /usr/home/yaoya/php/var/log/php-fpm.log
log_level = notice
[www]
listen = 127.0.0.1:9000
user = yaoya
group = yaoya
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
启动php fastcgi:
/usr/home/yaoya/php/sbin/php-fpm
安装nginx 0.7.67:
wget http://nginx.org/download/nginx-0.7.67.tar.gz
cd nginx-0.7.67
./configure --prefix=/usr/home/yaoya/nginx
make
make install
配置nginx(nginx.conf):
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/home/yaoya/nginx/html/scripts$fastcgi_script_name;
include fastcgi_params;
}
启动nginx:
/usr/home/yaoya/nginx/sbin/nginx
使用ab进行压力测试,和apache2对比:(100000次)
100并发:
apache html(1k):12455.30
nginx html(1k):15127.89
apache php(phpinfo):1158.29
nginx php(phpinfo):3759.40
500并发:
apache html(1k):7884.27
nginx html(1k):16394.00
apache php(phpinfo):1181.46
nginx php(phpinfo):3542.59
结论nginx和apache在默认设置下单台处理性能比约为3:1。
PHP 5.3.3的php-fpm比PHP 5.2.13的php-cgi占用内存小多了。很期待PHP 5.3.3的表现。
来源:http://yaoya.org/wp/index.php/post/93
http://syre.blogbus.com/logs/20092011.html
估计今后的配置:nginx0.8.50 + php3.3.3 + mysql
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3524/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2010-9-24 16:32
评论列表
2011-5-25 15:09 | yaoya
hi, google自己的名字时,没想到我的博客竟然有人引用,更没想到竟然在同一栋楼工作。。。(我在12层)。不介意的话,能否和我邮件联系下。我有几个blog hosting的问题想咨询下。
分页: 1/1 1