Our hosting provider offers multiple versions of PHP. Below we have outlined the current versions available and how to use them.
Currently the default version of PHP is 5.3.x. If you want to use PHP 5.2.x or 5.4.x or if you would like to quickly change back to PHP 5.3, just add one of the following commands to your .htaccess file.
PHP 5.2
AddHandler application/x-httpd-php52 .php |
PHP 5.3 (Default)
AddHandler application/x-httpd-php53 .php |
PHP 5.4
AddHandler application/x-httpd-php54 .php |
Note: Below is the direct PHP 5.2, 5.3 and 5.4 binary paths.
/usr/local/php52/bin/php
/usr/local/php53/bin/php
/usr/local/php54/bin/php
Temporary Note: While PHP 5.3 is listed as the default in this article, it is only setup this way on some of our servers. We are in the process of upgrading all of our servers with this change, however this is a slow process. This is also true about php 5.4; it is only available on part of our servers currently. Once your server has been upgraded with the change, you will receive an email informing you. If your server has not been upgraded yet, the current default version of PHP on your server is 5.2. If you need php 5.3, please see the section above on what AddHandler to use to tell the server to use php 5.3.
Step by Step Instructions
Below we will outline the steps needed to create and modify a htaccess file with the lines needed to set the PHP version. We will use the File Manager for cPanel.
cPanel
Here is how to access the File Manager and get to the correct folder from within cPanel
1) Click the File Manager button located in the Files section of cPanel.
2) Select the Home Directory and the Show Hidden Files option, then click Go.
Please move to the File Manager section of this article (see below).
File Manager
1) Click the New File button at the top-left hand side of the screen.
2) Enter “.htaccess” as the file name, and leave the location blank.
3) Rich click the new htaccess file we just created.
4) Click the Code Edit option from the right click menu.
5) Add the AddHandler for the version of PHP you wish to use (located above). Then click the Save Changes button.
That’s it! Your whole account will now be using the version of PHP you specified in the htaccess file. If you wish to set the PHP version on a folder by folder basis, simply move/create/edit (if you already have one) the htaccess file in the folder you wish to change.
