<object id="xwuag"></object>
      1. <tbody id="xwuag"><pre id="xwuag"><video id="xwuag"></video></pre></tbody>
        <progress id="xwuag"></progress>

        <nav id="xwuag"><big id="xwuag"><rt id="xwuag"></rt></big></nav>
        <em id="xwuag"></em>

        <nav id="xwuag"></nav><rp id="xwuag"></rp>
        <li id="xwuag"></li>
      2. <rp id="xwuag"></rp>
        <s id="xwuag"></s><th id="xwuag"><pre id="xwuag"><video id="xwuag"></video></pre></th>
      3. <nav id="xwuag"><center id="xwuag"></center></nav>
          <dd id="xwuag"><big id="xwuag"></big></dd>

          FastCGI 进程管理器(FPM)

          Table of Contents

          FPM(FastCGI 进程管理器)用于替换 PHP FastCGI 的大部分附加功能,对于高负载网站是非常有用的。


          • 支持平滑停止/启动的高级进程管理功能;

          • 可以工作于不同的 uid/gid/chroot 环境下,并监听不同的端口和使用不同的 php.ini 配置文件(可取代 safe_mode 的设置);

          • stdout 和 stderr 日志记录;

          • 在发生意外情况的时候能够重新启动并缓存被破坏的 opcode;

          • 文件上传优化支持;

          • "慢日志" - 记录脚本(不仅记录文件名,还记录 PHP backtrace 信息,可以使用 ptrace或者类似工具读取和分析远程进程的运行数据)运行所导致的异常缓慢;

          • fastcgi_finish_request() - 特殊功能:用于在请求完成和刷新数据后,继续在后台执行耗时的工作(录入视频转换、统计处理等);

          • 动态/静态子进程产生;

          • 基本 SAPI 运行状态信息(类似Apache的 mod_status);

          • 基于 php.ini 的配置文件。

          add a note add a note

          User Contributed Notes 8 notes

          robin at robinwinslow dot co dot uk
          8 years ago
          Init script setup

          You will probably want to create an init script for your new php-fpm. Fortunately, PHP 5.3.3 provides one for you, which you should copy to your init directory and change permissions:

          $ cp <php-5.3.3-source-dir>/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
          $ chmod 755 /etc/init.d/php-fpm

          It requires a certain amount of setup. First of all, make sure your php-fpm.conf file is set up to  create a PID file when php-fpm starts. E.g.:
          pid = /var/run/php-fpm.pid
          (also make sure your php-fpm user has permission to create this file).

          Now open up your new init script (/etc/init.d/php-fpm) and set the variables at the top to their relevant values. E.g.:

          Your init script is now ready. You should now be able to start, stop and reload php-fpm:

          $ /etc/init.d/php-fpm start
          $ /etc/init.d/php-fpm stop
          $ /etc/init.d/php-fpm reload

          The one remaining thing you may wish to do is to add your new php-fpm init script to system start-up. E.g. in CentOS:

          $ /sbin/chkconfig php-fpm on


          Disclaimer: Although I did just do this on my own server about 20 mins ago, everything I've written here is off the top of my head, so it may not be 100% correct. Also, allow for differences in system setup. Some understanding of what you are doing is assumed.
          ikrabbe dot ask at gmail dot com
          1 year ago
          I'm very unhappy with the way php-fpm handles requests.
          There isn't even some SCRIPT_FILENAME in the RFC for CGI, an that's the only standard I found to handle the requests.

          Actually what you are doing with PATH_TRANSLATED is supposed to translate to the path, which is broken by media wikis, as they use the PATH_INFO to find the ressource, not some script.

          In the original CGI context, the PATH_INFO is passed to the CGI binary to specify some ressource argument. So actually

              SCRIPT_NAME  ~ argv0
              PATH_INFO      ~ argv1

          in command context.

          Conclusion: We should rewrite php-fpm to obey the rfc3875 CGI standard.
          Having SCRIPT_NAME pointing to /something.php, must translate to


          CWD is the working directory where php-fpm is started (or configured to change to).

          In case of chroot CWD = "".

          In any case the SCRIPT_NAME php script can be found with ./SCRIPT_NAME, from the CWD. So the undocumented not standardized SCRIPT_FILENAME should vanish! It breaks the CGI standard.
          user at NOSPAM dot example dot com
          1 year ago
          It is important to note that FPM is not built with the windows binaries.  Many of the guides you may find online rely on php-cgi.exe.  Unfortunately they call it FPM but this is incorrect!

          The executable php-cgi.exe that is bundled with the windows binaries is a FastCGI interface but it is *not* FPM (Fastcgi Process Manager).  php-cgi.exe does not have multi-threading or concurrent request support, nor support for any of the FPM configuration options.

          The only solid information I've gathered into why FPM is not available is a bug report explaining that FPM is built around fork(), which is not natively available on windows (https://bugs.php.net/bug.php?id=62447).
          ganlvtech at qq dot com
          1 year ago
          php-fpm is not avaliable on Windows, but you can use IIS or Apache as the "fastcgi process manager".

          If you have to use Nginx, here is a solution. Nginx provides a load balancing module. We can distribute the request to different php-cgi.exe process.


          This is the origin nginx conf.
          location ~ \.php$ {
              try_files  $uri = 404;
              fastcgi_index  index.php;
              include  fastcgi.conf;

          You can replace it by
          upstream php {

          location ~ \.php$ {
              try_files  $uri = 404;
              fastcgi_pass  php;
              fastcgi_index  index.php;
              include  fastcgi.conf;


          php-cgi.exe process will die after several requests, so you have to restart the php-cgi.exe manually to keep a process listening the port.

          kokushibyou at gmail dot com
          6 years ago
          PHP-FPM is FAST - but be wary of using it while your code base is stored on NFS - under average load your NFS server will feel some serious strain. I have yet to find a work around for this bug: https://bugs.php.net/bug.php?id=52312
          joel k
          7 years ago
          the fpm process supports the USER2 signal, which is used to reload the config file.

          kill -USR2 [pid]

          should do the trick.
          dreamcat4 at gmail dot com
          5 years ago
          Doesn't work? Enable logging!

          The php-fpm.log file is a great place to fault-find errors and get to the bottom of a problem. But be sure to enable logging for your specific worker pool. Or you won't see anything!


          To enable error logging for the default [www] worker pool, add this line in the [www] section of your php-fpm.conf:

          catch_workers_output = yes
          info at f1-outsourcing dot eu
          1 month ago
          It looks like the php-fpm daemon is not able to use its groups it is running with.



          国产成人午夜福利r在线观看_欧美性受xxxx孕妇_白丝娇喘过膝袜爽短裙调教_jizz jizz xxxx