Home > Backend Development > PHP7 > body text

Precautions for php-fpm parameter configuration of php7+

藏色散人
Release: 2023-02-17 15:46:01
forward
2853 people have browsed it

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
Copy after login

Check whether php-fpm is started:

ps -ef|grep php
Copy after login

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
Copy after login

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进程数量
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:segmentfault.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template