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. Spring AMQP 源码分析 06 - 手动消息确认

    ### 准备 ## 目标 了解 Spring AMQP 如何手动确认消息已成功消费 ## 前置知识 <Spring AMQP 源码分析 04 - MessageListener> ## 相 ...

  2. windows7 asp.net发布IIS 拒绝访问 解决方法

    在windows7中打开DNN网站有以下问题: CS0016: 未能写入输出文件“c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP ...

  3. 【Android】查看包名和首启动activity

    工具:aapt 位置:$ANDROID_HOME/build-tools/版本号/aapt 需要配置环境变量才能使用 aapt dump badging XXXapk 输出信息中重要的有: packa ...

  4. codeforces 576c// Points on Plane// Codeforces Round #319(Div. 1)

    题意:有n个点,找到一个顺序走遍这n个点,并且曼哈顿距离不超过25e8. 由于给的点坐标都在0-1e6之间.将x轴分成1000*1000,即1000长度为1块.将落在同一块的按y排序,编号为奇的块和偶 ...

  5. 『Python』pycharm常用设置

    学习一下pycharm的快捷操作,提升速度,也提升舒适度,笑. 常用快捷键 ctrl + d :复制粘贴本行到下一行 ctrl + y :删除本行 ctrl + 鼠标点击 :跳转 ctrl + / : ...

  6. python-day65-django基础

    一.MTV模型 1.官方说明: Django的MTV分别代表: Model(模型):负责业务对象与数据库的对象(ORM) Template(模版):负责如何把页面展示给用户 View(视图):负责业务 ...

  7. 通过一个uri获取一个Bitmap对象

    Android 开发过程中,可能会用到的,通过一个uri获取一个Bitmap对象 private Bitmap getBitmapFromUri(Uri uri){  try  {   // 读取ur ...

  8. Spring Data Rest如何暴露ID字段

    package com.example.demo.config; import com.example.demo.model.Comp; import com.example.demo.model.P ...

  9. sublime 个人心得

    sublime 3快捷键: (1) Ctrl+O(Command+O)可以实现头文件和源文件之间的快速切换 (2) 双击可选中光标所在单词,三击可选中光标所在行(等同于Ctrl+L(Command+L ...

  10. MySQL解析过程、执行过程

    转载:https://student-lp.iteye.com/blog/2152601 https://www.cnblogs.com/cdf-opensource-007/p/6502556.ht ...