Middle
What is PHP-FPM?
sobes.tech AI
Answer from AI
PHP-FPM (FastCGI Process Manager) is an alternative FastCGI process manager for PHP. It provides higher performance and stability compared to traditional methods of using PHP with web servers, such as mod_php for Apache.
Its main features:
- Management of PHP process pools for parallel request processing.
- Support for various process management strategies (static, dynamic, ondemand).
- Logging of errors and slow requests.
- Monitoring of process status.
- Ability to reload without downtime.
Unlike mod_php, which integrates PHP directly into the web server, PHP-FPM runs as a separate process, exchanging data with the web server via the FastCGI protocol. This reduces resource consumption by the web server and allows more flexible management of PHP processes.
// Example configuration of PHP-FPM process pool
[www]
user = www-data
group = www-data
listen = /run/php/php7.4-fpm.sock ; Or IP:port
pm = dynamic ; Process management strategy
pm.max_children = 50 ; Maximum number of child processes
pm.start_servers = 5 ; Number of servers started at launch
pm.min_spare_servers = 5 ; Minimum number of idle servers
pm.max_spare_servers = 35 ; Maximum number of idle servers