Server Status
 
View Entry
   
Subject How to change the PHP version for a specific folder or directory
Author HelpDesk Staff
 

It is posible to change the PHP version per directory (folder). To switch PHP to the desired version in a particular folder, just add an "Add Handler" line to the ".htaccess" file in that directory. (Or create a file called ".htaccess" in the desired folder if it does not already exist).

Here are some examples to change the PHP version used to execute .php files:

To run PHP 5.2, add the following line to .htaccess:

AddHandler application/x-httpd-php52 .php

To run PHP 5.3, add the following line to .htaccess:

AddHandler application/x-httpd-php53 .php

To run PHP 5.4, add the following line to .htaccess:

AddHandler application/x-httpd-php54 .php

To run PHP 5.5, add the following line to .htaccess:

AddHandler application/x-httpd-php55 .php

To run PHP 5.6, add the following line to .htaccess:

AddHandler application/x-httpd-php56 .php

NOTES:

1. Sub-folders will use the same PHP version as the parent folder… unless you override it with another .htaccess entry in that sub-folder.

2. You can change the PHP settings and extensions/modules for each different PHP version using the "Change PHP Version" area in your cpanel hosting control panel.

TeamViewer Remote Desktop Support