multiphp for managing PHP and PHP-FPM in cPanel

Many hosting providers have a large customer base with varying needs for their online projects. The MultiPHP Manager interface allows you to easily manage the PHP and PHP-FPM configurations of your cPanel accounts and domains and is available for systems running EasyApache 4. There are quite a few different features that the MultiPHP Manager interface provides, including:

  • Hosting providers can switch between a number of different PHP versions with the click of a button, or allow more advanced users to upgrade to a newer version of PHP more quickly than others.
  • System Administrators can select the system’s PHP version (the global default PHP version for all accounts) and manage PHP-FPM configuration on each domain.
  • In EasyApache 4, each PHP version can be set to use a different PHP handler.
  • A systems administrator can manage the pool option of any virtual host they own.

Let’s get a little more in-depth into these features!

System PHP Version
 

System PHP Version is the version of PHP that is the global default version for all accounts on a server. This setting can only be changed by a root-level user. When any new account is created on a server, that account will use the System PHP version by default, and any primary domain set to  InheritFor cPanel & WHM versions older than the upcoming version 80, the default System PHP version will become the latest version of PHP installed on the server. In versions beyond 80, the default System PHP version will be PHP 7.2.

To change the system default PHP, perform the following steps:

  1. Click  Edit  in the  System PHP Version  section.
  2. Select your desired PHP version from the menu.
  3. Click  Apply 

Changing the system’s default PHP version will also change any primary domain set to Inherit

PHP Handlers

In EasyApache 4, each PHP version can use a PHP handler (a type of Apache module that contains libraries that the Apache webserver can use to interpret and run PHP code). The PHP Handlers tab allows you to select the PHP handler that each version of PHP uses. So if there was a scenario where a user wanted a certain Apache module on one version of PHP, but not another, the MultiPHP Manager feature makes this possible. With the flexibility of PHP Handlers, you can allow users to run whichever versions of PHP that you make available to them.

Using the Domains Table

In EasyApache 4, each domain or virtual host can use any currently-installed PHP version or currently-installed PHP-FPM setting. 

The domains table displays the following information:

  • Domain — The domain’s name.
  • Account — The domain’s account name.
  • Account Owner — The account owner’s name.
  • PHP Version — The PHP version that the domain currently uses, and whether the account inherited that setting.
  • PHP-FPM — The domain’s PHP-FPM status.

Parked domains (aliases) are not listed in the domains table. These domains will just use the same settings as the domain they’re aliased to.

PHP-FPM and System Pools

PHP FastCGI Process Manager (PHP-FPM) is a very speedy alternative FastCGI daemon for PHP that grants your websites the ability to set specific amounts of resources to process a domain’s requests.  PHP-FPM maintains pools, which are workers available to respond to PHP requests. These pools of workers are what allow the website to process a higher load of requests than other handlers might allow. PHP-FPM differs from SUPHP in that PHP-FPM does not overload a system’s memory with PHP from Apache processes, unlike ruid2+php-dso .

For instance, your site may receive a large boost of traffic after being featured in an ad campaign or mentioned on a television show. This new method will allow you to process extra traffic that requires additional resources without lifting a finger. 

PHP-FPM uses a service to serve PHP requests that Apache routes traffic to and will only execute PHP requests, enabling PHP-FPM to service content quicker than other customary methods. For users who are serving content that’s not explicitly PHP-based, i.e., Ruby applications, and are switched to PHP-FPM, fear not. Sites that are not written in PHP will continue to work and serve properly using PHP-FPM, as only PHP sites would be affected. With that being said, non-PHP sites might not see the same performance boosts with PHP-FPM.

You’re able to designate which domains utilize PHP-FPM by enabling or disabling it within the MultiPHP Manager interface. Also, you can customize the Pool Options to fit your needs. Need one domain to process 1000 child processes at once but another on 5? Just adjust the pool options for each, and you’re all set.

What’s New with MultiPHP in Version 78?

In version 78, we’ve added the ability to automatically configure some PHP INI settings directly from WHM’s MultiPHP Manager Interface (WHM >> Home >> Software >> MultiPHP Manager). The new System PHP-FPM Configuration tab allows WHM users to set the system’s PHP INI directives (if you’re a systems administrator, these can still be updated manually through the command line).

Additionally, PHP-FPM Pool Options have been moved to a new tab in the MultiPHP Manager Interface, where systems administrators can access the system PHP-FPM Pool Options through the new System PHP-FPM Configuration tab. Clicking Edit PHP-FPM  from the domain’s row in the domain table will give you access to domain-specific pool options and the ability to edit Pool Options for that domain, as well as the domain’s PHP INI directives.

CloudLinux PHP Selector and Why Choosing Your PHP Version is Important

CloudLinux has a similar tool in their offering that allows a user to swap between different versions of PHP. The difference between what they have available and what cPanel has is thus: the CloudLinux PHP selector is a component that sits on top of CageFS allowing each user to select their desired PHP version and modules.  cPanel’s MultiPHP selector does not require having CloudLinux as their OS of choice and does not require CageFS, as the CloudLinux selector does (we do highly recommend using cagefs, however). CloudLinux also patches and ships End of Life PHP versions going back as early as 4.4, whereas cPanel only offers those PHP versions that are still currently supported.

Giving customers the ability to choose their desired version of PHP allows them to be flexible in their maintenance and design of their sites. For those end-users who are slower to adapt to the newest and most secure versions of PHP, MultiPHP selector offers a sliding scale of versions that allow those slower to adapt users a chance to upgrade their PHP versions at a moderate pace. They’re also given a chance to switch the PHP handler and test their site to see what issues they may run into once the PHP version is changed while being able to swap back and correct any issues before the server’s PHP version is changed.

Would you like to discuss the MultiPHP Manager more, or have questions? Please reach out to us on our Official cPanel Slack and Discord channels, or our official cPanel Subreddit!