3 FastCGI Process Manager (FPM)

Source: Internet
Author: User
Tags fpm

The 1 FPM (FastCGI process Manager) replaces most of the additional features of PHP FastCGI and is useful for high-payload sites.

Its features include:

Support Smooth stop/ start advanced process management function, can work on different uid/gid/" slow log " --  Special features: Used to continue to perform time-consuming work in the background (input video conversion, statistical processing, etc.) after the request completes and refreshes the data; dynamic/static subprocess generation; basic SAPI run status information (similar to Apache mod_status); php.ini-based configuration file. 

2 Compiling from source code

The--ENABLE-FPM configuration option is required to activate FPM support when compiling PHP.
The following are the specific configuration parameters for FPM compilation (all optional parameters):

--with-fpm-user-Set the user identity of the FPM run (Default---with-fpm-group-Set the FPM Runtime user group (default---with-fpm-systemd-Enable SYS TEMD Integration (Default-5.6. 5 version effective

3 Configuration

The FPM configuration file is php-fpm.conf and its syntax is similar to php.ini.

1 php-fpm.conf Global Configuration segment

Pidstringthe location of the PID file. The default is empty. Error_logstringthe location of the error log. Default: Installation path #INSTALL_PREFIX #/log/php-Fpm.log. Log_levelstringThe error level. The available levels are: alert (which must be processed immediately), error (Error condition), warning (warning condition), notice (general important information), debug (debug information). Default: Notice. Emergency_restart_thresholdintFPM Restarts if the child process receives a SIGSEGV or Sigbus exit information number for that parameter setting within the time set by Emergency_restart_interval. 0Indicates "Turn off this feature." Default value:0(Close). The Emergency_restart_interval Mixedemergency_restart_interval is used to set the interval between smooth reboots. Doing so helps to solve the problem of using shared memory in the accelerator. Available units: s (seconds), M (min), H (Hours), or D (days). Default unit: s (seconds). Default value:0(Close). Process_control_timeout Mixed sets the time-out period for the child process to accept the master process multiplexing signal. Available units: s (seconds), M (min), H (Hours), or D (days). Default unit: s (seconds). Default value:0(Close). Daemonize Boolean sets FPM to run in the background. Set "No" to keep FPM running in the foreground for debugging. Default value: Yes. 

2 Run Configuration section

in FPM, you can use different settings to run multiple process pools. These settings can be set individually for each process pool. Listenstringsets the address that accepts the FastCGI request. Available formats are:'Ip:port','Port','/path/to/unix/socket'. Each process pool needs to be set. Listen.backlogintSet Listen (2) of the half-connection queue length. “-1"Means no limit. Default value:-1. Listen.allowed_clientsstringsets the server IPV4 address that is allowed to connect to FastCGI. Equivalent to PHP FastCGI (5.2.2+) in the FCGI_WEB_SERVER_ADDRS environment variable. Only works on TCP snooping. Each address is separated by commas and, if not set or empty, allows any server to request a connection. Default value: Any. Listen.ownerstringif used, represents the permission to set Unix sockets. In Linux, read and write permissions must be set to be used for WEB server connections. In many BSD-derived systems, permissions can be ignored to allow free connections. Default: Runs the users and groups used, with permissions of0666. Listen.groupstringSee Listen.owner. Listen.modestringSee Listen.owner. Userstringthe FPM process runs as a UNIX user. Must be set. GroupstringThe FPM process runs the Unix user group. If not set, the default user's group is used. PMstringsets how the process manager manages child processes. Available values:Static, OnDemand,Dynamic. Must be set. Static-the number of child processes is fixed (pm.max_children). OnDemand-processes are generated when they are needed (when requested, withDynamicinstead, Pm.start_servers is started when the service starts. Dynamic-The number of child processes is dynamically set based on the following configuration: Pm.max_children,pm.start_servers,pm.min_spare_servers,pm.max_spare_servers. Pm.max_childrenintpm Set toStaticThe number of child processes that are created, PM is set toDynamicrepresents the maximum number of child processes that can be created. Must be set. This option sets a limit on the number of requests that can be served at the same time. Similar to the maxclients settings in Apache mpm_prefork and the Php_fcgi_children environment variables in normal PHP fastcgi. Pm.start_serversinchsets the number of child processes created at startup. Only in PM set toDynamicWhen used. Default value: Min_spare_servers + (max_spare_servers-min_spare_servers)/2. Pm.min_spare_serversintsets the minimum number of idle service processes. Only in PM set toDynamicwhen used. Must be set. Pm.max_spare_serversintsets the maximum number of idle service processes. Only in PM set toDynamicwhen used. Must be set. Pm.max_requestsintsets the number of requests for the service before each child process is reborn. is useful for third-party modules that may have a memory leak. If set to'0'The request is always accepted, equivalent to the php_fcgi_max_requests environment variable. Default value:0. Pm.status_pathstringthe URL of the FPM status page. If not set, the status page cannot be accessed, the default value: None. Ping.pathstringthe ping URL of the FPM monitoring page. If not set, the ping page cannot be accessed. This page is used to externally detect whether FPM is alive and can respond to requests. Note that you must start with a slash (/). Ping.responsestringThe return response used to define the ping request. Return to HTTP $The text/Plain formatted text. Default value: Pong. Request_terminate_timeout Mixed sets the time-out for a single request to abort. This option may be in the php.ini settings'Max_execution_time'Scripts that are not aborted for some special reasons are useful. Set to'0'Said'Off'。 Available units: s (seconds), M (min), H (Hours), or D (days). Default unit: s (seconds). Default value:0(Close). Request_slowlog_timeout mixed when a time-out is requested for this setting, the corresponding PHP call stack information is written to the slow log in its entirety. Set to'0'Said'Off'。 Available units: s (seconds), M (min), H (Hours), or D (days). Default unit: s (seconds). Default value:0(Close). Slowlogstringlogging of slow requests. Default value: #INSTALL_PREFIX #/log/php-Fpm.log.slow. Rlimit_filesintsets the Rlimit limit for the file open descriptor. Default value: System-defined value. Rlimit_coreintsets the maximum limit value for the core rlimit. Available values:'Unlimited',0or a positive integer. Default value: System-defined value. Chrootstringthe Chroot directory at startup. The defined directory needs to be an absolute path. If not set, Chroot is not used. ChDirstringSets the startup directory, which is automatically Chdir to the directory when it starts. The defined directory needs to be an absolute path. Default value: Current directory, or root directory (chroot). Catch_workers_output Boolean redirection runs during the stdout and stderr to the primary error log file. If not set, stdout and stderr will be redirected to the following FastCGI rules./dev/NULL。 Default value: None.


3 FastCGI Process Manager (FPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.