You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Page tree
Skip to end of metadata
Go to start of metadata

Overview

In WHM's MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager), the term "Inherit" refers to how Apache determines a domain or virtual host's PHP version. When you set a domain to use the Inherit option, Apache uses the PHP version that exists in the first .htaccess file that it finds in the domain's file structure. If the system cannot find a .htaccess file, Apache uses the system default PHP version.

Important:

As of cPanel & WHM version 78, the system enables PHP-FPM by default and sets the PHP version of each account to the PHP 7.2 (ea-php72) value. You cannot set an account's PHP version to use the Inherit option with PHP-FPM enabled.

How inheritance works

Only one single default PHP version exists in EasyApache 4's MultiPHP environment. You set this default version at the system level. The system sets the PHP version of each new domain to the default value.

When the system searches for the version of PHP to use, it starts in the cPanel & WHM default document root of the current domain and continues up the directory tree until it finds a .htaccess file with PHP version information. Apache must locate a .htaccess file to properly inherit a PHP version from a primary domain. 

  • If Apache does not find a .htaccess file, it uses the system default PHP version from WHM's MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager).
  • If Apache finds an invalid version of PHP in the .htaccess file, it uses the system default PHP version set in WHM's MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager). 

Notes:

  • For a primary domain, the default document root is the /$HOME/user/public_html directory.
  • For a subdomain or addon domain, the default document root depends on your server's settings. For more information, read our Tweak Settings documentation.

Important:

We strongly recommend that you only set the PHP version with WHM's MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager). If you set your PHP version manually, you may experience unexpected behavior.

Examples

In the following table, assume that the system uses PHP 7.1 by default. PHP inheritance follows the following path:

Note:

In the following table, the third.blee.com and sixth.foobar.com domain examples are only valid if you set the Restrict document roots to public_html option in WHM's Tweak Setting interface (WHM >> Home >> Server Configuration >> Tweak Settings) to Off.


Domain nameTypePHP settingHas .htaccess file?Effective PHP versionDocument Root within the /public_html directory
blee.comPrimary domainInheritNo7.1Yes

first.blee.com

SubdomainInheritNo7.1Yes

second.blee.com

Subdomain7.0Yes7.0Yes

third.blee.com

Subdomain7.0No7.0No
foobar.comPrimary domain7.0Yes7.0Yes

fourth.foobar.com

SubdomainInheritNo7.0Yes

fifth.foobar.com

Subdomain5.6Yes5.6Yes

sixth.foobar.com

Subdomain5.6No7.0No

Additional documentation

There is no content with the specified labels

There is no content with the specified labels

There is no content with the specified labels