Articles on: Files Management
This article is also available in:

How to change the PHP version of a folder or subdomain?

If you want to update the PHP version applicable to your account, you can do so directly from cPanel.

You can also modify the PHP version for only one of your domains, subdomains or folders. Simply add a line of code to the .htaccess.

Steps to change the PHP version of a folder or subdomain



Log in to your cPanel account (via your customer account or https://www.bmoname.com:2083).

In the Files section of your control panel, click your File Manager.

Navigate to the folder or subdomain you want to change the PHP version of. Then find the . htaccess associated with it, or create a new one if necessary.

Modify your .htaccess file to include this code:

<FilesMatch " .(php4|php5|php3|php2|php|phtml) $">
SetHandler application/x-lsphp82
</FilesMatch>


Note that the second line of the code defines the version of PHP that will be used. In the previous example, the code defined version 8.2 as the one to use.

If you want to use another version, you must adjust the code according to your choice. Here are the codes for the different versions of PHP:

PHP versionCode
5.2application/x-lsphp52
5.3application/x-lsphp53
5.4application/x-lsphp54
5.5application/x-lsphp55
5.6application/x-lsphp56
7.0application/x-lsphp70
7.1application/x-lsphp71
7.2application/x-lsphp72
7.3application/x-lsphp73
7.4application/x-lsphp74
8.0application/x-lsphp80
8.1application/x-lsphp81
8.2application/x-lsphp82


Save the changes to your .htaccess file so that the change takes effect.

Updated on: 17/05/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!