php php-fpm装配记录

WBOY
Release: 2016-06-13 13:21:34
Original
760 people have browsed it

php php-fpm安装记录

转载自http://hi.baidu.com/snailzzz/blog/item/d61de8452e477d2dcefca3b0.html

?

?

snail_run整理

什么是cgi

???????CGI全称是公共网关接口”(Common Gateway Interface)HTTP服务器与你的或其它机器上的程序进行交谈的一种工具,其程序须运行在网络服务器上。

???????????CGI可以用任何一种语言编写,只要这种语言具有标准输入、输出和环境变量。
?????????
php,perl,tcl.(以上转自:?http://baike.baidu.com/view/32614.htm)

什么是fastcgi

FastCGI?像是一个常驻?(long-live)?型的?CGI,它可以一直执行着,只要激活后,不会每次?都要花费时间去?fork?一次?(这是?CGI?最为人诟病的?fork-and-execute?模式)。它还支持分布式的运算,??FastCGI?程序可以在网站服务器以外的主机上执行并且接受来自其它网站服务器来的请求。

?????????????????????????????????????以上转自:http://baike.baidu.com/view/641394.htm

?

fastcgicgi特点

1.???????CGIFastCGI也具有语言无关性.

2.???????CGI, FastCGI在进程中的应用程序,独立于核心web服务器运行,提供了一个比API更安全的环境。(APIs把应用程序的代码与核心的web服务器链接在一起,这意味着在一个错误的API的应用程序可能会损坏其他应用程序或核心服务器;?恶意的API的应用程序代码甚至可以窃取另一个应用程序或核心服务器的密钥。)

3.???????虽然FastCGI不能一夜之间像cgi那样普及,但fastcgi的开发人员致力于把fastcgi作为一个开放性的标准进行传播. FastCGI技术目前支持语言有:C/C++JavaPerlTclPythonSmallTalkRuby等。相关模块在Apache, ISS, Lighttpd等流行的服务器上也是可用的。

4.???????CGIFastCGI的不依赖于任何Web服务器的内部架构,因此即使服务器技术的变化, FastCGI依然稳定不变。

以上摘自: http://www.fastcgi.com/drupal/node/2

?

php-fpm

????????

?

?

?

php-fpm文档中文翻译

?

http://syre.blogbus.com/logs/20092011.html

?

PHP-FPM之新中文文档

转自:http://www.mikale.org/html/2009/03/99.html

,php-fpm是一个好东西,最佳配合平台是nginx,只有它能实现优化上传的功能.机制原理知道了,但是为什么优化了上传,想不太清 楚,保存到文件之后读入,fast CGI?协议中读取有这么大的性能差别?我想应该跟mysqlnd一样,是节约了内存吧,而不是增加了性能..传递文件名比传递fast cgirequest body,更加节约内存,速度的话,我不认为在内存上操作1k比起操作10M的数据有太大的差别

神仙做了新的翻译,原因看文档.

php-fpm改造SAPI,PHP守护进程化,从而很多功能就得以实现.

有一个主的PHP进程为守护进程,然后可以监控子PHP进程..增加的大部分特性都基于这个原理.

?

php-fpm??spawn-cgi?对比测试

转自:http://www.cyask.com/question.php?qid=441

?

php-fpm的使用非常方便,配置都是在php-fpm.ini的文件内
而启动,重启都可以从php/sbin/php-fpm中进行
?方便的是修改php.ini后可以直接使用php-fpm reload进行加载
无需杀掉进程就可以完成php.ini的修改加载
结果显?示使用php-fpm可以使php有不小的性能提升
php-fpm
控制的进程.cpu回收的速度比较慢.内存分配的很均匀
spawn- cgi控制的进程CPU下降的很快.而内存分配的比较不均匀.
有很多进程似乎未分配到,而另外一些却占用很高.
可能是由于进程任务分配的?不均匀导致的.而这也导致了总体响应速度的下降
php-fpm合理的分配.导致总体响应的提到以及任务的平均

?

?

PHP FastCGI?进程管理器: PHP-FPM

http://www.dbanotes.net/web/php_fastcgi_phpfpm.html

php-fpmspawn-fcgi?比较

http://none.at/phpfm/docs/current_php_fastcgi_problems_en.html

?

http://php-fpm.org/

http://imcat.in/

?

?

安装记录

?

参考:张晏http://blog.s135.com/nginx_php_v6/

?

php fastcgi

wget?http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.13-fpm-0.5.13.diff.gz

?

wget?http://www.php.net/get/php-5.2.13.tar.gz/from/this/mirror

?

tar zxvf php-5.2.13.tar.gz
gzip -cd php-5.2.13-fpm-0.5.13.diff.gz | patch -d php-5.2.13 -p1???
#
:fpm以打补丁的方式放到php安装目录。据官方http://php-fpm.org/

消息php-fpm已经放到php的核心代码的svn中,相信不久就不用以打补丁安装了
cd php-5.2.13/

?

./configure --enable-fastcgi --prefix=/data1/server/php-cgi --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-mysql --with-mysqli --with-pdo-mysql --enable-sockets --with-curl --with-ttf --with-libxml-dir --with-config-file-path=/data1/server/php-cgi/etc --with-zlib --enable-exif --enable-ftp --with-xmlrpc --enable-zip --with-iconv-dir --with-libxml-dir --with-mcrypt --with-tidy --with-tidy --enable-fpm --enable-force-cgi-redirect

?

?

make && make install

cp php.ini-dist /data1/server/php-cgi/etc/php.ini

?

ulimit -SHn 65535

/data1/server/php-cgi/sbin/php-fpm start

出现错误

[ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool 'default'

注释取消掉

./etc/php-fpm.conf中的

nobody???

nobody

?

?

?tail -f /data1/server/php-cgi/logs/php-fpm.log

可以查看log
如果是出现9000端口被占用的话,执行“killall -9 php-cgi”杀掉进程,在启动就OK了
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!