PHP-FPM is an Apache module that brings much better performance (approximately 300%) for PHP script processing compared to other preceding modules like suPHP, CG or DSO (Dynamically Shared Object). FPM stands for FastCGI Process Manager.
The major change in the management of PHP processing comes with the introduction of Workers Processes which can be spawned from a Master Process that receives the request. The processing happens in parallel then and the output is served back to the Web Server (Apache/NGINX). The spawning of Worker Processes happens in three ways:
- Static: Opted for high-traffic sites where a fixed allocation of Workers will reduce computing for Worker-allocation. Incorrect configuration with respect to available server capacity may result in timeout or gateway error (403 or 504 HTTP status codes).
- Dynamic: Opted for sites where traffic can vary and multiple sites compete for resource allocation.
- On-demand: Opted for low-traffic sites.
The important feature of PHP-FPM is an adaptive process spawning where Workers are dynamically spawned and killed on-demand.
The settings for PHP-FPM is important for good performance of the site(s) hosted on your VM (Virtual Machine) – Request limit, Timeout limit and Workers limit. You can install and run PHP-FPM on any VM with at least 2GB RAM or at least more than 30MB RAM per site on the VM. All Batoi Virtual Machines come with PHP-FPM support.
- The PHP-FPM Home Page: https://php-fpm.org
- The Official PHP Documentation: https://www.php.net/manual/en/install.fpm.php
- cPanel Management Guide: https://documentation.cpanel.net/display/78Docs/PHP-FPM
- The Official Guide for PHP-FPM with NGINX: https://www.linode.com/docs/web-servers/nginx/serve-php-php-fpm-and-nginx/