PHP Selector Integration with cPanel MultiPHP Manager

Navigation:  PHP Selector > Control Panel Integration >

PHP Selector Integration with cPanel MultiPHP Manager

Previous pageReturn to chapter overviewNext page

[Requires CageFS 5.5-6.18+]

 

When using EasyApache4 in cPanel, it is possible to change PHP versions for users' domains with MultiPHP Manager (when PHP is working under Apache web server). Also it is possible to change system default PHP version with MultiPHP Manager in WHM.

 

MultiPHP Manager in WHM looks as follows:

 

cPanel_integration

 

A user can change PHP version for domain in cPanel interface but can not change System default PHP version.

 

cPanel_integration01

 

PHP Selector works in different ways with EasyApache4 and EasyApache3. CageFS should be enabled for users who use PHP Selector. The novation is that when using  EasyApache4, actual PHP version used depends on PHP version selected in MultiPHP Manager. When PHP version chosen for domain in MultiPHP Manager matches System default PHP version, then PHP Selector is used to select actual PHP version. If PHP version chosen for domain in MultiPHP Manager differs from System default PHP version, then PHP version from MultiPHP Manager is used.

 

In other words, PHP Selector deals with changing System default PHP version.

 

PHP Selector algorithm for choosing PHP version for domain is as follows:

 

1. If CageFS is disabled, then PHP Selector is not active and MultiPHP Manager PHP version is applied.

 

2. If CageFS is enabled, then:

 

2.1. If PHP version chosen in MultiPHP Manager differs from System default PHP version, then MultiPHP manager PHP version is applied.

 

2.2. If PHP version chosen in MultiPHP Manager is the same as System default PHP version, then PHP Selector PHP version is applied:

 

2.2.1. If Native option is selected in PHP Selector, then MultiPHP Manager PHP version is applied.

 

2.2.2. If PHP version chosen in PHP Selector differs from Native, then PHP Selector PHP version is applied.

 

cPanel_integration02

 

cPanel_integration03

 

cPanel_integration04

 

PHP version chosen in MultiPHP Manager can also be applied to console commands /usr/bin/php and /usr/local/bin/php. In this case .htaccess file search is performed in current directory and in parent directories. If the file is found, then PHP version specified in it is applied, if not found, then System default PHP version is applied. System default PHP version can be changed via PHP Selector.

 

1. If CageFS is disabled, then PHP Selector is not active and PHP version from .htaccess is applied.

 

2. If CageFS is enabled, then:

 

2.1. If PHP version specified in .htaccess file differs from System default, then .htaccess version is applied.

 

2.2. If System default PHP version is specified in .htaccess file, then PHP Selector version is applied:

 

2.2.1. If Native option is chosen in PHP Selector, then .htaccess PHP version is applied.

 

2.2.2. If PHP version chosen in PHP Selector differs from Native, then PHP Selector version is applied.

 

Note. cPanel prior to 11.56 does not support hooks to add processing of System default PHP version changes with MultiPHP Manager. That is why System default PHP version changing is handled by cron job (/etc/cron.d/cagefs_cron file), which executes the command  /usr/share/cagefs/setup_multiphp_integration every ten minutes, which means that all System default PHP version changes in MultiPHP Manager are applied in CageFS with 10 minutes delay.

 

In cagefs-5.5-6.25 or later, changing of System default PHP version with MultiPHP Manager will be processed with cPanel WHM hooks.

 

PHP Modules

 

The set of PHP modules depends on PHP version used for domain or console. If PHP Selector is active and Alt-PHP version is chosen, then modules chosen for this Alt-PHP version in PHP Selector are used. If PHP Selector is not active, then modules for PHP version chosen in cPanel MultiPHP are used.

 

PHP Options

 

cPanel has MultiPHP INI Editor available in WHM and in cPanel user interface.

 

MultiPHP INI Editor allows setting PHP options for any PHP version globally for all domains and users. At this point /opt/cpanel/ea-php56/root/etc/php.d/local.ini file is generated and options values are written into this file. Such options have higher priority than the options set in MultiPHP INI Editor in cPanel user interface. MultiPHP INI Editor allows to set PHP options in Basic Mode (simplified interface) and in Editor Mode.

 

MultiPHP INI Editor in WHM looks as follows:

 

cPanel_integration05

 

cPanel_integration06

 

 

Note. cPanel prior to 11.56 does not support hooks to add processing of INI options changing for PHP version with MultiPHP INI Editor in cPanel WHM. That is why for now the processing of PHP version changing is handled by cron job (/etc/cron.d/cagefs_cron file) which performs the command /usr/share/cagefs/ setup_multiphp_integration every 10 minutes, which means that INI options changes for PHP version in MultiPHP INI Editor in cPanel WHM are being applied with up to 10 minutes delay.

 

In cagefs-5.5-6.25 or later, INI options changes for PHP version in MultiPHP INI Editor in cPanel WHM will be processed by cPanel WHM hooks.

 

MultiPHP INI Editor in cPanel user interface allows setting options for php.ini files in user home directory or in domain docroot. Changes are applied immediately without delay.

 

These options priority is lower than ones specified in MultiPHP INI Editor WHM interface. MultiPHP INI Editor in cPanel user interface looks as follows

 

cPanel_integration07

 

cPanel_integration08

 

If PHP Selector is active, then options set in PHP Selector are applied, and such options have higher priority than options in custom php.ini file in domain docroot. If PHP Selector is disabled, then options set in MultiPHP INI Editor are applied.

 

QUIRKS: When changing System default PHP version, administrator should take into consideration the following quirk. For example, if a user has chosen PHP 5.3 for domain and System default PHP version is PHP 5.5, then PHP Selector will not be used for user domain. In this case, if administrator switches System default PHP version from 5.5 to 5.3, then PHP Selector will be activated for user domain and PHP version chosen in PHP Selector will be applied for domain.

 

That is why it is recommended for administrator to avoid changing System default PHP version to PHP version that is already used by users. At the same time it is recommended for users to choose inherit for domain and use PHP Selector to choose PHP version. In this case PHP version chosen in PHP Selector will be always applied for domain.