How to run sites on different PHP versions in cPanel

By default all sites of the account run on one PHP version - the one selected in "Select PHP Version" (how to change it). If one site needs another version - for example, an old shop needs PHP 7.4 while the other sites run on 8.3 - set its version separately in "MultiPHP Manager".

1. Choose the version for the site

  1. Open "MultiPHP Manager" (group "Software").
  2. In "Set PHP Version per Domain", tick the site. You can tick several.
  3. In "PHP Version" on the right, choose a version marked alt-php, for example "PHP 7.4 (alt-php74)".
  4. Click "Apply".
Own PHP version for shop.example.com
Own PHP version for shop.example.com

The "PHP Version" column now shows the chosen version for the site. The other sites are marked "Inherited" - they run on the shared version from "Select PHP Version". The number next to "Inherited" is the server system version; such sites actually use the version from "Select PHP Version".

The site runs on its own PHP version
The site runs on its own PHP version

Choose alt-php versions - these are the CloudLinux builds the hosting sites run on. The change applies immediately, nothing needs restarting.

2. Check that the version changed

Create a file phpver.php in the site folder (how to create and edit a file) with one line:

<?php echo PHP_VERSION;

Open https://shop.example.com/phpver.php - the page shows the version, for example 7.4.33. Delete the file afterwards.

3. PHP limits for this site

The "Options" tab of "Select PHP Version" only affects sites on the shared version. For a site with its own version, set limits in "MultiPHP INI Editor":

  1. Open "MultiPHP INI Editor" (group "Software"), "Basic Mode".
  2. Pick the site folder in the list, for example shop.example.com. The site PHP version and its settings appear below.
  3. Change the values you need: memory_limit, upload_max_filesize, post_max_size, max_execution_time.
  4. Click "Apply".
PHP limits for one site
PHP limits for one site

The panel writes the settings to php.ini and .user.ini in the site folder. Other sites are not affected.

PHP extensions

A site with its own version uses the standard extension set of that version: mysqli, pdo_mysql, gd, curl, mbstring, intl, zip, imagick and others CMS need. The ticks on the "Extensions" tab of "Select PHP Version" do not apply to it. If the site needs a missing extension, contact support.

How to return the site to the shared version

  1. In "MultiPHP Manager", tick the site.
  2. Choose "inherit" in "PHP Version".
  3. Click "Apply".

You can do the same in "Select PHP Version", "Per Domain Settings" tab: the "Use PHP Selector" button in the site row. It also shows which sites are managed by MultiPHP Manager and which by "Select PHP Version".

Which sites have their own PHP version
Which sites have their own PHP version

Cron for a site with its own version

In cron jobs, use the same PHP version as the site - otherwise the script runs on the shared version:

/opt/alt/php74/usr/bin/php /home/USERNAME/shop.example.com/cron.php

Replace php74 with the version you need: php81, php82 and so on. More about cron - cron jobs.

PHP 5.x, 7.x and 8.0 no longer get security fixes. Keep a site on an old version only temporarily, while you update the CMS and plugins.

Questions and answers
Yes. The shared version is set in "Select PHP Version", a single site gets its own in "MultiPHP Manager".
The site runs on its own version from "MultiPHP Manager". Change its limits in "MultiPHP INI Editor".
In "MultiPHP Manager", tick the site, choose "inherit" and click "Apply".