PHP-FPM (FastCGI Process Manager) is a popular alternative to PHP’s traditional mod\_php Apache module. It is a process manager that allows PHP to handle heavy loads of traffic more efficiently. Here’s how to use PHP-FPM performance settings on Drupal 8:
1. Install PHP-FPM on your server. If you’re running a Linux-based server, you can use your package manager to install it. For example, on Ubuntu or Debian, you can run the command:
sudo apt-get install php-fpm
1. Once PHP-FPM is installed, you’ll need to configure it. The configuration files are usually located in /etc/php/
1. Navigate to the /etc/php/VERSION/fpm/pool.d/ directory and create a new configuration file for your Drupal site. For example, you can create a file called drupal.conf:
sudo nano /etc/php/VERSION/fpm/pool.d/drupal.conf
1. Add the following settings to your configuration file:
[drupal]
user = www-data
group = www-data
listen = /run/php/drupal.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max\_children = 10
pm.start\_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max\_requests = 500
The above settings are just an example. You can tweak the values to suit your site’s requirements.
1. Save the configuration file and restart PHP-FPM:
sudo systemctl restart php7.4-fpm
1. Finally, configure your Nginx or Apache server to use the PHP-FPM socket. This will depend on your specific web server setup.
By following the above steps, you can optimize your Drupal 8 site’s performance by using PHP-FPM to handle traffic more efficiently.