This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Adding Handlers to change your PHP Version

Overview

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 web server. The web server 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.

  1. Open the File Manager located on the cpanel.
  2. On the directory selection popup, choose Web Root and select Show Hidden Files.
  3. Click Go
  4. In the table of files, you should see a file named .htaccess. Right click on the .htaccess file and select code edit.
  5. You may get a popup asking about encoding. If so, click the edit button.
  6. 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.
  7. 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 5.4

# Use PHP5.4 as default
            AddHandler application/x-httpd-php54 .php

PHP 5.4 Single php.ini

# Use PHP5.4 Single php.ini as default
            AddHandler application/x-httpd-php54s .php

PHP 5.4 FastCGI

# Use PHP54CGI as default
            AddHandler fcgid54-script .php

PHP 5.6

# Use PHP5.6 as default
            AddHandler application/x-httpd-phpbeta .php

PHP 5.6 Single php.ini

# Use PHP5.6 Single php.ini as default
            AddHandler application/x-httpd-phpbetas .php

PHP 5.6 FastCGI

# Use PHP54CGI as default
            AddHandler fcgidbeta-script .php

PHP 7.0

# Use PHP7 as default
            AddHandler application/x-httpd-php70 .php

PHP 7.0 Single php.ini

# Use PHP7 Single php.ini as default
            AddHandler application/x-httpd-php70s .php

PHP 7.0 FastCGI

# Use PHP70CGI as default
            AddHandler fcgid70-script .php
Knowledgebase Article 175,140 views bookmark tags: htaccess php


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

What are Apache Handlers? How do I setup customized Apache Handlers?
Knowledgebase Article 98,180 views tags: apache handler handlers

How to change your PHP version in your hosting account
Knowledgebase Article 439,254 views tags: config php

This article will explain how to use Easy Apache to recompile Apache. This is useful if you want to change the version of PHP or change other PHP and Apache settings.
Knowledgebase Article 35,683 views tags: apache build compile dedi dedicated easy modules version vps

Related Help Content

Changing PHP versions, load custom Apache mods, and other Apache/PHP customizations
Knowledgebase Article 65,214 views tags: easyapache php vps whm

How do I change the PHP environment for my site with php.ini?
Knowledgebase Article 604,157 views tags: configuration php server

The redirection of www.yourdomain.com/default.html or index.html to http://www.yourdomain.com/index.php?act=whatever redirects it to http://www.yourdomain.com/index.php%3fact=whatever In other words,
Knowledgebase Article 806,786 views tags: htaccess messing mod php redirect redirects rewrite variable variables

500 Internal Server Error when installing via the MOJO Marketplace installer.
Knowledgebase Article 154,255 views tags: cpanel errors htaccess panel php script simpel

How to customize your html or php error pages.
Knowledgebase Article 96,001 views tags: errors php

This article will explain how to change or reset the password for a MySQL user.
Knowledgebase Article 38,717 views tags: change mysql password reset user

What is the .htaccess file and where can I find more information?
Knowledgebase Article 1,892,222 views tags: htaccess tips tricks

This article explains how to enable FastCGI for PHP applications.
Knowledgebase Article 93,288 views tags: fastcgi php

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.