Home  >  Article  >  Backend Development  >  Precautions for php-fpm parameter configuration of php7+

Precautions for php-fpm parameter configuration of php7+

藏色散人
藏色散人forward
2020-06-13 16:12:002662browse

When installing php7, if these parameters of php-fpm are set improperly, php-fpm will not be started, the nginx site will not be able to parse the php file, and a 404 error will be reported.

Related commands:

centos7, start php-fpm:

systemctl start php-fpm

Check whether php-fpm is started:

ps -ef|grep php

php - The core parameter configuration of 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

Only for dynamic mode, the dynamic description is as follows:

max_children:动态方式下限定php-fpm的最大进程数
start_servers:动态方式下的起始php-fpm进程数量
min_spare_servers :动态方式空闲状态下的最小php-fpm进程数量
max_spare_servers :动态方式空闲状态下的最大php-fpm进程数量

If these parameters are changed incorrectly, php-fpm will not start, and nginx will not start. You can't access the php file. You can check the log to troubleshoot the error:

/usr/local/php/var/log/php-fpm.log

Summary of rules:

max_children 必须大于 min_spare_servers
max_children 必须大于 max_spare_servers
start_servers 必须大于 min_spare_servers
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 time, so I added a 0 after it. , respectively 50, 20, 10, 30.

Related recommendations: "PHP7"

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:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete