1. bluehost knowledge base

How To Add Handlers To Change PHP Version - PHP Version Setup


This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files by directly editing your .htaccess file. If you do not wish to edit the .htaccess file, you can use the cPanel to change your PHP version, as explained in PHP Config.

Adding the Handler to the .htaccess File

The PHP handler is written into the .htaccess file. The .htaccess file is a hidden file that is read by the webserver. The webserver follows any instructions contained within the file. There are many ways to access this file. For the purposes of this article, we will explain accessing it through the File Manager on the cPanel of your hosting account.

Note: The Advanced tab will load your cPanel. Legacy accounts will feature a horizontal navigation bar at the top of the screen, while Bluerock account users will see a vertical navigation menu on the left-hand side of the screen. To learn more, please see Bluerock vs. Legacy.


  1. Log in to your Bluehost  account.
  2. Click the Advanced tab from the side navigation menu to the left.
  3. Under the File section, click the File Manager icon.
  4. Look for the Settings button located towards the upper right corner of your screen.
  5. Click the Preferences, then toggle the radio button for "Show Hidden Files (dotfiles)."
  6. Click the Save button when finished.
  7. Locate the .htaccess file, right-click on it, and select edit.
  8. At the top of the file, insert the PHP handler for the version you would like to use. If there is a handler in the file already, it should be removed or replaced with your new handler.
  9. Click Save.


  1. Open the File Manager located on the cPanel.
  2. On the directory selection popup, choose Web Root, select Show Hidden Files, then click the submit button.
  3. In the table of files, you should see a file named .htaccess, right-click on it and select the code edit.
  4. You may get a popup asking about encoding. If so, click the edit button.
  5. At the top of the file, insert the PHP handler for the version you would like to use. If there is a handler in the file already, it should be removed or replaced with your new handler.

    Note: See the Available PHP Handlers section for handlers on each of the PHP versions available. You can copy and paste these directly into the file.

  6. Click Save.

Once you have saved the file, you can close it. Your account will then use the PHP version you selected.

Available PHP Handlers

The following handlers can be copied and pasted directly into your .htaccess file:

PHP Standard PHP (Default)

All accounts use Standard PHP by default. You can install the default php.ini file to your public_html folder using the PHP Config option inside your cPanel. You can make any changes or modifications to that file and take a guide over the master file. The Standard PHP on the cPanel will need to copy the modified php.ini 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 will help you avoid copying the same php.ini file to each directory containing php files. This option changes the php handler defined in ~/public_html/.htaccess to indicate that all subfolders use the same php.ini found in public_html/.

# 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

Important Note: The .htaccess php handler is looping through all subdirectories unless a subdirectory has a .htaccess file and defining a php handler.


The FastCGI for PHP makes all your PHP applications tenacious and uses only one php.ini file in the public_html directory. Also, there is no per-request startup and initialization indirect cost. 
This PHP makes possible the development of applications that would otherwise be ineffective within the CGI paradigm (e.g., a huge PHP script or an application that requires a connection to one or more databases). Using the PHP FastCGI option makes all 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

For further assistance, you may contact our Chat Support or Phone Support via 888-401-4678. You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.