Home >Backend Development >PHP Problem >How to set up php-fpm in amh

How to set up php-fpm in amh

藏色散人
藏色散人Original
2020-08-20 09:17:342137browse

How to set up php-fpm in amh: first open the "wordpress.conf" file; then modify "pm=static" or "pm = dynamic" to "pm = ondemand"; and finally restart amh.

How to set up php-fpm in amh

Recommended: "PHP Video Tutorial"

Set php-fpm to ondemand mode in AMH

AMH has only two php-fpm modes by default, static and dynamic. The characteristic of using both is that php-fpm will not release memory to the operating system.

Each php-fpm thread will occupy about 20M of memory. For example, the default 3 threads will occupy about 60M, and this 60M will not be released.

So you will see in the host that you may only have one or two stations, and there is currently no traffic, and the memory is still high.

The AMH panel itself also uses static mode and 2 threads. In other words, the panel will occupy approximately 40 4 = 44M of theoretical memory.

Then, the necessity of the ondemand mode exists. The characteristic of ondemand mode is that depending on the maximum number of threads, it will also occupy the same level of memory. For example, 3 threads will also occupy about 60M. However, when the request ends, the memory will be automatically released within 5-15 seconds.

Currently, since AMH itself does not carry this mode, it can only be completed manually. The operation method is very simple.

1. For the configuration of php-fpm, each site has its own file. Its naming method is website identification.conf, and the path is under /usr/local/php/etc/fpm

For example, if my site ID is wordpress, then there will be a /usr/local/php/etc/fpm/wordpress.conf

2. Open the file and modify pm = static or pm = dynamic Set pm = ondemand, then /etc/init.d/amh-start to restart amh

3. If you want to change the php-fpm mode of the AMH panel itself, modify /usr/local/php/etc/php -fpm.conf file is enough, and the modified content is the same as above.

The above is the detailed content of How to set up php-fpm in amh. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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