PHP

Tutorials and guides on PHP

Upgrading PHP on HostGater

Written by: Peter Fisher on August 9, 2012
Tagged under: , ,
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
PHP Hypertext Preprocessor

PHP was called Personal Home Page before version 3.0. It is now a recursive acronym and stands for PHP Hypertext Preprocessor

In this post I will show you how to upgrade PHP 5.2.17 to PHP 5.3.14 on HostGaters shared hosting platform using a .htaccess file.

Many web hosting companies allow you to upgrade and downgrade the version of PHP to either 5.2.x or 5.3.x. Both versions of PHP are quite different, the later is faster, has a bundle of security fixes and improves its OOness.  Some functions are deprecated in PHP5.3.x and any site moving from 5.2.x to 5.3.x should be tested thoroughly in a development/testing environment before the upgrading their production site.  Frameworks like Symfony2 utilize the new features in 5.3.x, whereas some frameworks aren’t compatible with the latest toys just yet.

At the moment there are lots of sites using legacy versions of PHP and this will probably be the case for several years to come (There are some PHP4 sites still around 🙁 ).  As a developer this can be a bit of pain as you end up with a mixture of clients on a mixture of PHP versions, which leads to a mixture of PHP framework versions being used. On the plus side, many hosting companies allow you to switch the PHP versions quite easily.  As a rule of thumb I make sure any new sites I build are on the latest and greatest version of PHP or at the very least, the most recent version their hosting service allows them to be on.

HostGater allows the version of PHP to be switched in their shared hosting platform via the following code placed in a  .htaccess file.

AddType application/x-httpd-php53 .php

A few grumbles with HostGater:

1) They assume that new sites will be made in PHP 5.2.x and not PHP 5.3.x. As a developer I would prefer to opt-out of the 5.3 rather than opt-in to it.

2) Their latest version of PHP is still is a version behind the latest stable release. At the time of writing this post, it is only 5.3.14

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Peter Fisher is a web developer working in Gloucester UK. Founder of the digital agency Websomatic, author of this blog and the HowToCodeWell Youtube channel. Peter has over ten years of web development experience under his belt

Read all about Peter Fisher

Leave a Reply

Your email address will not be published. Required fields are marked *