Table of Contents
snail_run整理" >snail_run整理
php-fpm" >php-fpm
php-fpm文档中文翻译" >php-fpm文档中文翻译
PHP FastCGI?进程管理器: PHP-FPM" >PHP FastCGI?进程管理器: PHP-FPM
Home Backend Development PHP Tutorial php php-fpm装配记录

php php-fpm装配记录

Jun 13, 2016 pm 01:21 PM
cgi fastcgi fpm php with

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了
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

See all articles