What is PHP-FPM?

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

These features include:

  • Adaptive process spawning (NEW!)
  • Basic statistics (ala Apache's mod_status) (NEW!)
  • Advanced process management with graceful stop/start
  • Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode)
  • Stdout & stderr logging
  • Emergency restart in case of accidental opcode cache destruction
  • Accelerated upload support
  • Support for a "slowlog"
  • Enhancements to FastCGI, such as fastcgi_finish_request() - a special function to finish request & flush all data while continuing to do something time-consuming (video converting, stats processing, etc.)

It was not designed with virtual hosting in mind (large amounts of pools) however it can be adapted for any usage model.

Why PHP-FPM?

PHP-FPM not only makes configuration of FastCGI pools, but also enhances some of the FastCGI internals and increases error reporting, script terminiation, etc.

This table has a simple comparison between the most popular methods of managing FastCGI pools.

Description PHP "out of the box" spawn-fcgi + spawn-php.sh + daemontools PHP-FPM
PHP daemonization: pid file, log file, setsid(), setuid(), setgid(), chroot() (-) (+) (+)
Process Management. Ability to "gracefully" stop and start PHP workers without losing any queries. This allows gradually updating the configuration and binary without losing any queries. php4 (-), php5 (only graceful completion) (-) (+)
Restricting IP addresses from which requests can come from php4 (-), php5 (+) (since 5.2.2) (-) (+)
Dynamic number of processes, depending on the load (adaptive process spawning) (-) (-) in SVN, PHP 5.3.3RC1+
Starting the workers with different uid/gid/chroot/environment and different php.ini options. (No need for safe mode.) (-) (-) (+)
Logging stdout and stderr (-) (-) (+)
Ability to emergency restart all the processes in the event of an accidental destruction of the shared memory opcode cache, if using an accelerator (-) (-) (+)
Forcing the completion of process if set_time_limit() fails (-) (-) (+)
Features
Error Header (+)
Accelerated Upload Support (+)
fastcgi_finish_request() (+)
Slowlog (with backtrace) (+)

History

Andrei Nigmatulin is the original author of PHP-FPM. Since 2004, he waited for someone else to make PHP FastCGI production-ready, but he couldn't wait any longer. PHP-FPM is the product of the knowledge, experience and ideas from working with PHP's FastCGI SAPI on several projects.

Since that time, it has evolved into a stable, simple solution to an annoying problem that has not been addressed properly. In mid-2009, Andrei changed the format of PHP-FPM to be more modular, and no longer be a patch that had to be applied against PHP. The source code has been split up from one large patch to a normal set of files. Michael Shadle volunteered to take over the project and work on growing it into a more robust solution. There were a couple major features Andrei was never able to finish, and we're hoping to address those soon - the most important one is adaptive process spawning.

Currently, we're working on making sure that it can be packaged in distributions, the website is clean, consistent and easy to use, and the information is relevant, concise and up to date.

It has recently been brought in to PHP core, thanks to Antony Dovgal, with interim support from Dreamcat4 and continued work from Jérôme Loyet. Andrei's original vision is finally starting to become complete.

Real-world Usage

PHP-FPM serves up millions of PHP requests without an issue for hundreds of websites, with more growing each day. At Open Source Bridge in Portland, Rasmus mentioned he now uses nginx + PHP-FPM at wepay.com, the company he works for. It doesn't get more ratified than that!

License

PHP-FPM is available for public use and licensed under the GPL. The modified version of libevent, which is bundled with PHP-FPM, is distributed under a the BSD license.

转自 https://php-fpm.org/

php-fpm简介的更多相关文章

  1. FPM简介(定制rpm包)

    FPM简介 fpm是生成rpm包的工具.rpm包的制作,采用fpm工具完成,FPM非常易用,此命令可以把rpm包的安装.卸载做得更加优雅,在安装前可以做一些准备工作,安装后可以做一些收尾工作,在卸载前 ...

  2. fpm来制作rpm包

    转自 http://blog.halfss.com/blog/2013/02/26/fpmbao-guan-li/ 另查看 http://my.oschina.net/lxcong/blog/1438 ...

  3. nginx简介与配置

    nginx简介 nginx(发音同engine x)是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like协议下发行. nginx由俄罗斯的程序 ...

  4. LAMP简介与部署

    lamp简介 lamp,是由Linux+Apache+Mysql/MariaDB+Php/Perl/Python的一组动态网站或者服务器的开源软件,除Linux外其它各部件本身都是各自独立的程序,但是 ...

  5. ASP.NET Core 1.1 简介

    ASP.NET Core 1.1 于2016年11月16日发布.这个版本包括许多伟大的新功能以及许多错误修复和一般的增强.这个版本包含了多个新的中间件组件.针对Windows的WebListener服 ...

  6. MVVM模式和在WPF中的实现(一)MVVM模式简介

    MVVM模式解析和在WPF中的实现(一) MVVM模式简介 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在 ...

  7. Cassandra简介

    在前面的一篇文章<图形数据库Neo4J简介>中,我们介绍了一种非常流行的图形数据库Neo4J的使用方法.而在本文中,我们将对另外一种类型的NoSQL数据库——Cassandra进行简单地介 ...

  8. REST简介

    一说到REST,我想大家的第一反应就是“啊,就是那种前后台通信方式.”但是在要求详细讲述它所提出的各个约束,以及如何开始搭建REST服务时,却很少有人能够清晰地说出它到底是什么,需要遵守什么样的准则. ...

  9. Microservice架构模式简介

    在2014年,Sam Newman,Martin Fowler在ThoughtWorks的一位同事,出版了一本新书<Building Microservices>.该书描述了如何按照Mic ...

  10. const,static,extern 简介

    const,static,extern 简介 一.const与宏的区别: const简介:之前常用的字符串常量,一般是抽成宏,但是苹果不推荐我们抽成宏,推荐我们使用const常量. 执行时刻:宏是预编 ...

随机推荐

  1. Kafka特性

    ———————————————————————————————————————————————— [关键原理] 1.消息文件存储(消息堆积能力) 2.消息topic分区 3.消息顺序的保证 4.拉模型 ...

  2. 在WPF中添加Windows Form控件(包括 ocx控件)

      首先,需要向项目中的reference添加两个dll,一个是.NET库中的System.Windows.Forms,另外一个是WindowsFormsIntegration,它的位置一般是在C:\ ...

  3. iptable 大量需要封杀的ip地址便捷方法

    xu言: 最近家里出了点事,一直没有坚持写blog.感觉还有好一堆事等着我做呢.毕竟人生苦短,及时"行乐". 今天看到我的一个iptable的草稿,赶紧搬上来.以免日后忘记. 有些 ...

  4. React 介绍

    ttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind The sm ...

  5. Confluence 6 LDAP 连接池配置参数

    初始连接池大小(Initial Pool Size) 当初始化 LDAP 连接池的时候初始化创建的 LDAP 连接数量. 1 期望的连接池大小(Preferred Pool Size) 优化连接池的大 ...

  6. 最小生成树(模板 prim)

    Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可).现得到城镇道路统计表, 表中列出了任意两城镇间修建道路 ...

  7. FREETEXTBOX

    本文转自http://blog.csdn.net/JOHNCOOLS/archive/2006/04/08/655553.aspx感谢作者们的付出---------------版本: FreeText ...

  8. JS水平移动图片

    横向: <div id=demo style="overflow:hidden;width:200px;border:2px solid #e0e0e0;padding:2px;&qu ...

  9. OncePerRequestFilter的作用

    在spring中,filter都默认继承OncePerRequestFilter,但为什么要这样呢? OncePerRequestFilter顾名思义,他能够确保在一次请求只通过一次filter,而不 ...

  10. SQL Server 调优系列基础篇 - 并行运算总结(一)

    前言 上三篇文章我们介绍了查看查询计划的方式,以及一些常用的连接运算符.联合运算符的优化技巧. 本篇我们分析SQL Server的并行运算,作为多核计算机盛行的今天,SQL Server也会适时调整自 ...