Introduction to Configuration for PHP-FPM

Source: Internet
Author: User
Tags http 200 dedicated server
This article introduces, under the PHP environment PHP-FPM configuration method, to the PHP-FPM configuration option and the method makes the detailed introduction, has the need friend reference.

Contents of this section: PHP-FPM configuration

Configure Php-fpm:pid = Run/php-fpm.pidpid settings, default in the installation directory of Var/run/php-fpm.pid, recommended to open

Error_log = log/php-fpm.log error log, default in the installation directory Var/log/php-fpm.log

Log_level = notice 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 = 60emergency_restart_interval = 60s indicates the Emergency_restart_ If the number of php-cgi processes with SIGSEGV or sigbus errors within the values set by interval is more than Emergency_restart_threshold, PHP-FPM will be gracefully restarted. 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 background execution FPM, default is yes, if for debugging you can change to No. In FPM, you can use different settings to run multiple process pools. These settings can be set individually for each process pool.

Listen = 127.0.0.1:9000FPM Listening port, that is, the address of PHP processing in Nginx, the general default value can be. The available formats are: ' Ip:port ', ' Port ', '/path/to/unix/socket '. Each process pool needs to be set.

Listen.backlog = -1backlog, 1 means unrestricted, determined by the operating system, and this line is commented out.

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

Listen.owner = Wwwlisten.group = Wwwlisten.mode = 0666

UNIX socket Settings option, if you use TCP access, comment here.

user = Wwwgroup = account and Group for WWW start process

PM = How dynamic controls child processes, with static and dynamic options. 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, the maximum number of child processes Pm.start_servers, the number of processes at startup Pm.min_spare_servers, the minimum number of idle processes, and the creation of a new child process if the idle process is less than this value 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 = URL of the/STATUSFPM status page. If not set, the status page cannot be accessed. Default value: None.

Ping.path = Ping URL of the/PINGFPM 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 is 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′ ' for ' Off '. You can try changing this option when a 502 error occurs frequently.

Request_slowlog_timeout = 10s 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′ ' means ' Off '

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

Rlimit_files = 1024 Sets the Rlimit limit for the file opening descriptor. Default value: System-Defined value system default open handle is 1024, can be viewed with ulimit-n, ulimit-n 2048 modified.

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

chroot = 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 is started. The defined directory needs to be an absolute path. Default value: Current directory, or/directory (chroot)

Catch_workers_output = yes redirects the stdout and stderr in the run process to the primary error log file. If not set, stdout and stderr will be redirected to/dev/null according to the FASTCGI rules. Default value: Empty.

  • Related Article

    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.