• bg
  • en

Hosting, Domains, Virtual Private Servers (VPS), Managed VPS, SSL Certificates

How to Change PHP Version for a Specific Directory?

Control Panel cPanel
php, php version, php 5.2, php 5.3, php 5.4, php 5.5, php 5.6, php 7, php 7.1, php71

Under PHP Manager in cPanel you can change the PHP version for the entire hosting account or for a specific directory.

Below you can read how to set a different PHP version for a specific directory (website) of your hosting account.

Choosing a PHP Version (FastCGI) for a Specific Directory

You can enable a different PHP version for a certain directory (website) in two easy steps.

You first need to access "Set the PHP version for a particular directory" section under PHP Manager in cPanel.

Choosing PHP version and directory

From the options there you have to select the PHP version (1) and enter the desired directory (2). Finish the setup by clicking the Add button (3).

You need to create an .htaccess file or edit the existing one, located in the same directory. Afterwards, you should add the following lines to the file:

<IfModule mod_fcgid.c>
AddHandler fcgid-script .php
FcgidWrapper /home/cpuser/dir/php.fcgi .php
/home/cpuser/dir/ - replace it with the path to the directory;

You can copy these lines directly from the PHP manager after adding the system files to the desired directory.

After saving the changes in the .htaccess file, the selected PHP version will be enabled for the specified directory. You can check the PHP version that is enabled for the directory by placing a PHP file with phpinfo().

info-iconImportant: If there is an already existing .htaccess file that contains a line for PHP version setup such as AddHandler x-httpd-phpXX .php, you will have to remove it.

info-iconIn case you are not sure which version is enabled for the server where your hosting account is located, do not hesitate to сontact SuperHosting.BG technical support team.

All rights reserved © 2005-2019 ,