Home Backend Development PHP Tutorial Precautions for php-fpm parameter configuration of php7+

Precautions for php-fpm parameter configuration of php7+

Jul 06, 2018 pm 05:09 PM
php

This article mainly introduces the precautions for php-fpm parameter configuration of php7. It has certain reference value. Now I share it with you. Friends in need can refer to it.

Installation of php7, if Improper setting of these parameters of php-fpm will cause php-fpm to fail to start, the nginx site cannot parse the php file, and a 404 error will be reported.

Related commands:
centos7, start php-fpm:

systemctl start php-fpm
Copy after login

Check whether php-fpm is started:

ps -ef|grep php
Copy after login

The core parameter configuration of php-fpm, the default is as follows :

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
Copy after login

Only for dynamic mode, the dynamic description is as follows:
max_children: Limit the maximum number of php-fpm processes in dynamic mode
start_servers: The starting number of php-fpm processes in dynamic mode
min_spare_servers: The minimum number of php-fpm processes in the dynamic idle state
max_spare_servers: The maximum number of php-fpm processes in the dynamic idle state

If you pay attention to changing the wrong parameters, these parameters will cause php- fpm cannot be started, and nginx cannot access the php file. You can check the log to troubleshoot errors:
/usr/local/php/var/log/php-fpm.log

Rule summary:

  1. max_children must be greater than min_spare_servers

  2. max_children must be greater than max_spare_servers

  3. start_servers must be greater than min_spare_servers

  4. start_servers = min_spare_servers (max_spare_servers - min_spare_servers) / 2

PS: My server has 8G memory, and there is still a lot of free space at the moment, so I added a 0 after it. They are 50, 20, 10, and 30 respectively.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

PHP methods and parameter comments for operating Beanstalkd

The above is the detailed content of Precautions for php-fpm parameter configuration of php7+. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles