How to Change PHP Version

In some specific cases you may need to change PHP version in your web hosting account at WebHostingBuzz. We have implemented a server setup model that allows each customer to choose which version of PHP to use.

Default PHP version

The first step is to determine the default PHP version on the server. You can either use a PHP info page to do this, or find this out in cPanel directly as follows:

1. Log into cPanel.

2. Expand the Stats box on the left side:

cPanel expand stats

3. You will see the version of PHP currently installed on the server:

cPanel PHP version

This will indicate the default PHP version for your account.

Change PHP version

The above example indicates PHP 5.3.x as the default.

While this is something you normally shouldn’t worry about, it may happen so that the default PHP version isn’t compatible with some of your scripts. So if you happen to have PHP 5.3.x but need version 5.2.x – here’s what should be done.

1. Connect via FTP and go to public_html directory.

2. Edit your existing .htaccess file or create a new one.

[alert]The .htaccess file may not be displayed by default in some FTP clients. Make sure to enable displaying of hidden files in your FTP client.[/alert]

3. Add the following line before any other directives in the existing .htaccess file, or just in the 1st line if you’ve created a new file:

AddHandler application/x-httpd-php52 .php

This will switch to PHP version 5.2.x.

Similar instructions to be used if the default PHP version is 5.2.x and you need 5.3.x. In this case the only difference is in step 3 – you should add the following line to the beginning of .htaccess file to switch from PHP 5.2.x to PHP 5.3.x:

AddHandler application/x-httpd-php53 .php

This will switch to PHP version 5.3.x.

These settings are recursive by default, which means once you apply the change in public_html directory – it’ll work for all subdirectories. However, if you apply the change in a subdirectory – it won’t affect the root directory, so you may have different PHP versions working side by side within the same hosting account.

[alert style="danger"]Do not specify the default PHP version in .htaccess file. For example, adding AddHandler application/x-httpd-php53 .php to .htaccess on the server with PHP 5.3.x will result in error.[/alert]

Supported PHP versions

As of now we support PHP 5.2.x and PHP 5.3.x on all Web Hosting and Reseller Hosting servers.

PHP End of Life

R.I.P. versions 3.0 to 5.1

Some servers may also have PHP 4.x and will be upgraded eventually, so we don’t recommend to rely on the availability of PHP 4.x anymore.

Please, note that all 4.x branches of PHP have reached end of life and aren’t supported by cPanel.

PHP 5.2 branch has as well reached end of life, but is still supported by cPanel for compatibility reasons and will also be dropped at some point.

Although the latest stable PHP branch is 5.4, it has introduced a number of new features, including a built in web-server which has been designed for development purposes only and should not be used in production. Considering PHP’s tricky inter-branch compatibility record, we recommend 5.3 for most operations.

What if an unsupported version is needed

If you’re stuck with some really old web software and can’t upgrade for some reasons, or if you want to try the latest beta versions of PHP – it’s still possible with WebHostingBuzz.

Go ahead and get a virtual private server starting at $14.95/month, or a dedicated server starting at $139/month only! With unrestricted root access you’ll be able to install and configure any server-side software needed.

Recommendations

We highly recommend to use PHP 5.3.x branch and adapt your scripts accordingly.

If you’re using a ready-made PHP-based software (CMS, forum, shopping cart, etc) – be sure it’s up to date. In case the latest version of your software doesn’t support PHP 5.3.x – contact your software vendor for a new version or PHP 5.3 compatibility patch.

If all your web scripts support PHP 5.3 just fine but the default PHP version in your account is earlier than 5.3 – go ahead and use the above instructions to change PHP version to 5.3.x.

Resources

PHP: Unsupported Branches

PHP: All Releases (downloads)

PHP 5.4 – New Features


Was this article helpful?
Spread the word!
  • Tina The VA

    This must be out of date as WordPress now reccomends PHP 7.4 now.