Cpanel / WHM Tutorials

How to Enable PHP-FPM Using WHM

How to Enable PHP-FPM Using WHM

How to Enable PHP-FPM Using WHM

Introduction

What is PHP-FPM?

PHP-FPM is an improved PHP handler that uses a pool of workers (per domain) to quickly process PHP scripts.

Once the script completes running, PHP-FPM provides the results to Apache to deliver to the visitor’s browser.

This along with strategic caching, results in faster load times during unexpected spikes in traffic. In this guide, you will learn the steps needed to enable PHP-FPM through Web Host Manager (WHM).

PHP-FPM

Steps to Enable PHP-FPM for a domain:

To enable PHP-FPM, you must log in as a root user.

This feature is available for VPS and dedicated server users.

Resellers can contact your hosting provider to know whether PHP-FPM is enabled for your domain.

Let us discuss the steps to enable PHP-FPM for a particular domain in WHM panel.

 

How to Enable PHP-FPM Using WHM

1: Login to WHM as a root user

whm-root-login

2: Once logged in, find the feature ‘MultiPHP Manager‘ in WHM. It will be available under the section ‘Software

Multiphp-manager

3: Select Turn on to enable PHP-FPM for all cPanel accounts.

Alternatively, you can select the checkbox beside specific domains at the bottom, choose On from the dropdown menu beside PHP-FPM, and select Apply.

whm php-fpm multiphpmanager enable

 

4: Under the section ‘Set PHP version per Domain’, select the particular domain and enable PHP-FPM for it by clicking the checkbox.

Enable PHP-FPM

Edit Default PHP-FPM Settings on ssh

If you have many cPanel accounts, you may prefer to change the default settings for newly created cPanel accounts.

1: As root, SSH into your server or launch WHM terminal.

2: Create a system_pool_defaults.yaml file in the /var/cpanel/ApachePHPFPM directory.

To do this using nano, type the following:

nano /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

Add the following to the new file:

php_value_error_reporting: ‘E_ALL’
pm_max_children: 500
pm_max_requests: 2000
pm_min_spare_servers: 1
pm_max_spare_servers: 25
pm_process_idle_timeout: 150
php_value_disable_functions: 0

pm_max_children: Max number of child processes
pm_max_requests: Number of requests a child process executes before respawning.
pm_min_spare_servers: Minimum idle server processes
pm_max_spare_servers: Maximum idle server processes
pm_process_idle_timeout: Time until an idle process is killed in s(econds), m(inutes), m(inutes), h(ours), or d(ays).
php_value_disable_functions: Functions to disable. This doesn’t overwrite php.ini settings.

3: Save and exit the file. Using nano, press Control and x for the save prompt before exiting. Press y, then Enter ⤶ to save the file

4: Rebuild PHP-FPM using the following command:

/scripts/php_fpm_config –rebuild

5: Restart PHP-FPM using the following command:

/scripts/restartsrv_apache_php_fpm

We hope this tutorial helps

 

 

About the author

Jamie Vadym

Jamie Vadym

Founder of Error Hat. Expertise in Virtualization, Cloud Computing, Linux/UNIX systems, Programming,Storage systems,HA, Server Clustering e.t.c.

2 Comments

Click here to post a comment

    • Stop the FPM with the commands appropriate for your version of OS:
      #CentOS 5 & 6
      /etc/init.d/ea-php56-php-fpm stop
      disable
      chkconfig ea-php56-php-fpm off
      #CentOS 7
      systemctl stop ea-php56-php-fpm.service
      and
      disable
      systemctl disable ea-php56-php-fpm.service
      and Restart Apache with the following command:
      #CentOS 5 & 6
      /scripts/restartsrv httpd
      #CentOS 7
      systemctl restart httpd