Different PHP Version in the Subdomain / Addon Domain

1 min read

Updated on August 26, 2026

PHP version

Our cloud hosting runs CloudLinux, which lets every account choose its own PHP version. That is useful when an application needs a specific version, but it has one limitation: the Select PHP Version tool in cPanel applies to the whole account. You cannot pick a different version for an addon domain or a subdomain from that screen.

Changing the version for the whole account #

Go to cPanel > Select PHP Version, choose the version you want and click Apply. Every site in the account will then run on that version.

Using a different version for one subdomain or folder #

If one site needs a different version from the rest, set it with a handler in the .htaccess file of that site’s folder. The handler overrides the account default for that folder only.

Go to cPanel > File Manager, open the folder where that website lives, right-click .htaccess, choose Edit, and add the line for the version you need:

# php -- BEGIN cPanel-generated handler, do not edit
# Set the "alt-php84" package as the default "PHP" programming language.
AddHandler application/x-httpd-alt-php84___lsphp .php
# php -- END cPanel-generated handler, do not edit

The line for each version #

Only the two digits change. Copy the line that matches the version you want:

PHP 7.4 #

AddHandler application/x-httpd-alt-php74___lsphp .php

PHP 8.0 #

AddHandler application/x-httpd-alt-php80___lsphp .php

PHP 8.1 #

AddHandler application/x-httpd-alt-php81___lsphp .php

PHP 8.2 #

AddHandler application/x-httpd-alt-php82___lsphp .php

PHP 8.3 #

AddHandler application/x-httpd-alt-php83___lsphp .php

PHP 8.4 #

AddHandler application/x-httpd-alt-php84___lsphp .php

The pattern is always the same: drop the dot from the version number. PHP 8.3 becomes php83, PHP 8.4 becomes php84, and so on for future releases.

Things to check #

  • Use a version that is actually installed on your server. Open Select PHP Version in cPanel to see the list. A handler pointing at a version that is not installed will produce a 500 error.
  • If a handler block already exists in the file, edit the version in it rather than adding a second block. Two handlers in the same file will conflict.
  • Old PHP versions stop receiving security fixes. Unless an application specifically requires an older release, stay on a supported version.
  • If you cannot see .htaccess in File Manager, open Settings in the top right corner and tick Show hidden files.
  • If it still does not appear, the file does not exist yet. Create a new file named .htaccess in that folder.