How do I Switch between PHP versions?

Our servers run PHP4, PHP5.2, PHP5.3, PHP5.4 and PHP5.5. PHP5.3 runs by default.

You can change the default PHP version from the hosting control panel. In there you will find an icon with the name “Switch PHP Version”.

You can also override the default PHP version in a per-directory basis by using a web server directive that sets the default version of PHP for an entire site or folder.

For example, to set your hosting package’s default PHP version to 5.5 you can create a file named .htaccess, just outside the public_html directory, with the following contents:

SetEnv DEFAULT_PHP_VERSION 55

You can then override this in nested directories, so subdirectories in your public_html can have their own default PHP version. To do so you would could create a file in, say public_html/foo/.htaccess with the directive SetEnv DEFAULT_PHP_VERSION 53, and in that directory (and its subdirectories) PHP 5.3 will be used instead of 5.5, which we had set globally.

To verify which version of PHP you are running, create a new script in public_html/phpinfo.php with the following code:

<?php phpinfo(); ?>

Now go to http://yoursite.com/phpinfo.php and you should see the output from the phpinfo() function, which shows not only which PHP version you are running, but all PHP configuration information. Please delete this phpinfo.php script after you have checked as it is not good practice to leave such a script on the server.