How to use different versions of PHP in different directories in cPanel?

 Posted by Sakshita

How to use different versions of PHP in different directories in cPanel?

We all know that interface of cPanel has various features with which user can manage all its website data including database and emails. So, today I''m going to discuss one of the interesting method that will help you to improve the presentation of your website. 

Did you know that you can use multiple PHP versions in different directories  in cPanel? We all know that PHP version matters a lot for the performance of the website. But it is also important for some specific applications. That means to use a specific application you must have the required PHP version. Let us see how.


Suppose, there are two directories named abc and NEW in my File Manager for which I have to change the PHP version 5.6 and 7.4 respectively. So we just need to follow the below given steps to make the changes.
  • Login to cPanel account and get inside File Manager section.
Features of cPanel
  • Get inside the directory in which you need to update PHP version.
  • Right click over .htaccess file and then select Edit. Edit the file with the below given code.
  1. <IfModule mime_module> 
  2. AddType application/x-httpd-ea-php56 .php .php5 .phtml 
  3. </IfModule> 
  • Click over Save Changes to update the PHP version.
Now, all the files inside abc directory will use PHP version 5.6

Follow the similar steps to update the PHP version in NEW directory and update the PHP version 7.4 with the below given syntax.
  1. <IfModule mime_module> 
  2. AddType application/x-httpd-ea-php74 .php .php5 .phtml 
  3. </IfModule> 
*Note: You can use any version of PHP by changing the highlighted part in each code.

Hope this works for you !

FTP Accounts                                                        Email accounts

Cheapest Web Hosting                                         Cheapest Reseller Hosting

Comments