PHP is a server-side scripting language used to develop web applications and websites. The speed and performance of your website largely depends on the PHP version used by you. While it is best to use the latest version, some applications may work well with only specific PHP versions. In such cases, you will need to set specific versions of the PHP for different directories. 

Here, we guide you through the process to add PHP handlers to change the PHP version for use in a specific directory.


How to Use Different Versions of PHP Simultaneously?

You can use a combination of different versions of PHP running simultaneously in any directory by adding special codes or handlers to your .htaccess file, a hidden file that is read by the webserver. Editing of your .htaccess file allows you to customize the PHP version that runs your PHP file. However, if you do not wish to edit the .htaccess file, you can go the cPanel and change the version by following the instructions given in PHP Config.


Steps to Add PHP Handler to Your .htaccess File

The instructions contained in the .htaccess file are followed by the web server. So, if you wish to customize the PHP version, you need to add a handler to this file, which can be accessed through the file manager on the cPanel of your Web hosting account with us.


For Bluerock account holders:

  1. Login to your Bluehost account
  2. Go to the side navigation menu on the left and click on the advanced tab
  3. Go to the File section and click on the File Manager icon 
  4. Find the Settings button located on the upper right corner
  5. Click on preferences, then toggle the radio button for “Show Hidden Files”
  6. Locate the .htaccess file, select it and click on edit
  7. Insert the PHP handler for the version you wish to use at the top of the file. In case a handler already exists, remove it and replace with the new handler
  8. Click on Save


For Legacy account holders:

  1. Open the File Manager that is located on the cPanel
  2. Go to the directory selection popup, choose Web Root, select Show Hidden Files, and then click on the submit button
  3. Search for the .htaccess file in the table of files, right-click on it and select code edit
  4. If you get a popup asking about encoding, click on the edit button
  5. Insert the PHP handler for the version that you wish to use on the top of the .htaccess file. Do not forget to remove or replace any existing handler that is already present
  6. Save the file and close it

The PHP handlers can be copied and pasted directly into the .htaccess files.


List of PHP Handlers Available 

We offer the following PHP Handlers that can be copied and pasted in your .htaccess file.

PHP Standard PHP (Default)

All accounts by default use the Standard PHP version. The default php.ini.file can be installed in your public html folder by using the PHP Config option inside your cPanel. You can change or modify the file and copy the modified file into all subdirectories, including php files, to use the custom php settings.

# Use PHP(7|7.1|7.2|7.3|7.4) as default AddHandler application/x-httpd-php(70|71|72|73|74) .php


PHP Single php.ini

The Single php.ini handler will save your effort in copying the same php.ini.file in each directory containing php files. When you use this handler, changes are made in all the files.


# Use PHP(7|7.1|7.2|7.3|7.4) Single php.ini as default

AddHandler application/x-httpd-php(70|71|72|73|74)s .php


This .htaccess php handler is looping through all subdirectories except for when a subdirectory has a .htaccess file and defining a php handler.



This PHP FastCGI handler for PHP keeps all your PHP applications firm and uses only one php.ini.file in the public html directory. There is no per-request startup and initialization indirect cost involved.

You can use this handler to make your PHP applications run through mod_fcgid instead of mod_suphp.

# Use PHP(70|71|72|73|74)CGI as default

AddHandler fcgid(70|71|72|73|74)-script .php


Write A Comment