PHP-FPM Configuration Detailed _php tutorial

Source: Internet
Author: User
Tags http 200 dedicated server
php5.3 comes with PHP-FPM
Copy CodeThe code is as follows:

PID = Run/
PID settings, default in the installation directory of Var/run/, it is recommended to open

Error_log = Log/php-fpm.log
Error log, default in the installation directory of Var/log/php-fpm.log

Log_level = Notice
The 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_threshold = 60
Emergency_restart_interval = 60s
The emergency_restart_threshold will gracefully restart if the number of php-cgi processes that have SIGSEGV or sigbus errors within the values set by Emergency_restart_interval is more than PHP-FPM. These two options generally leave the default values.

Process_control_timeout = 0
Sets the time-out period for the child process to accept the primary process multiplexing signal. Available units: s (seconds), M (min), H (Hours), or D (day) default units: s (seconds). Default value: 0.

Daemonize = yes
The background performs FPM, and the default value is yes, if you want to change to no for debugging.

In FPM, you can use different settings to run multiple process pools. These settings can be set individually for each process pool.

Listen =
The FPM listener port, which is the address of the PHP processing in Nginx, is usually the default value.
The available formats are: ' Ip:port ', ' Port ', '/path/to/unix/socket '. Each process pool needs to be set.

Listen.backlog =-1
Backlog number, 1 means no limit, determined by the operating system, this line comments off.

Listen.allowed_clients =
Allow access to the IP of the fastcgi process, set any to unlimited IP, if you want to set other hosts Nginx can also access this FPM process, listen to set the cost of the IP can be accessed. The default value is any.
Each address is separated by commas. Allows any server to request a connection if it is not set or is empty

Listen.owner = www = www
Listen.mode = 0666
UNIX socket Settings option, if you use TCP access, comment here.

user = www
Group = www
Start the account and group for the process

PM = dynamic
How to control child processes, options are static and dynamic.
If Static is selected, the number of fixed child processes is specified by Pm.max_children.
If dynamic is selected, it is determined by the following argument:
Pm.max_children, maximum number of child processes
Pm.start_servers, number of processes at startup
Pm.min_spare_servers, the minimum number of idle processes is guaranteed, and if the idle process is less than this value, a new child process is created
Pm.max_spare_servers, the maximum number of idle processes is guaranteed, and if the idle process is greater than this value, the cleanup
For a dedicated server, the PM can be set to static.

pm.max_requests = 1000
Sets 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_path =/status
The URL of the FPM status page. If not set, the status page cannot be accessed. Default value: None.

Ping.path =/ping
The 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.response = Pong
Used to define the return of the ping request accordingly. Returns the Text/plain format text for HTTP 200. Default value: Pong.

Request_terminate_timeout = 0
Sets the time-out for a single request to abort. This option may be useful for scripts in php.ini settings where ' Max_execution_time ' is not aborted for some special reason. Set to ' 0′ ' to indicate ' Off '.
You can try changing this option when a 502 error occurs frequently.

Request_slowlog_timeout = 10s
When a request for this setting time-out expires, the corresponding PHP call stack information is written to the slow log. Set to ' 0′ ' means ' Off '

Slowlog = log/$pool. Log.slow
Slow-Request logging, with Request_slowlog_timeout

Rlimit_files = 1024
Sets the Rlimit limit for the file open descriptor. Default value: System-defined Value
System default open handle is 1024, can use Ulimit-n view, ulimit-n 2048 modify.

Rlimit_core = 0
Sets the maximum limit value for the core rlimit. Available values: ' Unlimited ', 0, or positive integer. Default value: System-defined value.

Chroot =
The Chroot directory at startup. The defined directory needs to be an absolute path. If not set, Chroot is not used.

ChDir =
Sets 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/directory (chroot)

Catch_workers_output = yes
REDIRECT StdOut and stderr to the primary error log file during the run. If not set, stdout and stderr will be redirected to/dev/null according to the FASTCGI rules. Default value: Empty. true techarticle php5.3 The PHP-FPM copy code code is as follows:/usr/local/php/etc/php-fpm.conf pid = run/ pid settings, default in the installation directory var/run/, it is recommended to open the error ...

  • 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: 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.