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. Codeforces 101487E - Enter The Dragon

    101487E - Enter The Dragon 思路:做的时候两个地方理解错了,第一个事我以为龙吸了水,水就干了,其实龙是在下雨之前吸的,下雨时湖水又满了,所以湖水永远不会干:第二个是以为只要找 ...

  2. threejs和particles.js

    particles.js 在线配置的东西: http://vincentgarreau.com/particles.js/ https://threejs.org/ http://thehuub.co ...

  3. C#对实体进行JSON序列化时枚举的处理

    实体类如下: public enum ESex { Boy, Girl } public class Person { public String Name { get; set; } public ...

  4. python--HTTPClient接口测试踩坑

    1.今天下午做接口测试的时候遇到一个奇怪的问题:原因不明 requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisc ...

  5. English trip M1 - PC9 Where am I Teacher:Jade

    In this lesson you will learn to ask for and give directions    # 在本课中,您将学习如何提出要求并给出指示 Words North  ...

  6. 『PyTorch』第十弹_循环神经网络

    RNN基础: 『cs231n』作业3问题1选讲_通过代码理解RNN&图像标注训练 TensorFlow RNN: 『TensotFlow』基础RNN网络分类问题 『TensotFlow』基础R ...

  7. Windows下sklearn源码安装

    简介 在Windows下编译sklearn源码,主要注意二点: 编译环境的搭建 编译顺序 编译环境的搭建 如果环境没有搭建好,最常见的报错,就是"error: Unable to find ...

  8. memcpy详解

    头文件:#include<string.h>函数原型:void *memcpy(void str,const void *s,size_t n); 功能 c和c++使用的内存拷贝函数.从源 ...

  9. dp练习(1)——马走日字

    3328: 马走日字 时间限制: 1 Sec  内存限制: 128 MB提交: 35  解决: 5[提交][状态][讨论版] 题目描述 一次外出旅游,你路上遇到了一个骑着马的强盗,你很害怕,你需要找一 ...

  10. EBS 中iSupplier模块中的MAPPING_ID

    在EBS的供应商模块中,有一个非常有意思的表 POS_SUPPLIER_MAPPINGS, 这个表中建立了supplier_reg_id,vendor_id,party_id之间的映射关系. 这个表中 ...