Bye Bye PHP 5.2

The reason these applications do well is because PHP hosting has been widely available for over a decade. Because PHP is on 90% of hosting setups from dedicated systems to cheap $4 a month deals, application developers have targeted PHP to help them reach their highest audience. Sadly, PHP hosts have always been slow to upgrade, but now it seems like the vast majority have finally made PHP 5.3 a viable option not just for in-house teams but for those building distributable applications too. Finally bidding farewell to PHP 5.2 feels good!

PHP is undeniably the most used language when it comes to building web applications. Around 78% of the internet is powered by PHP and the most popular web applications and content management systems are all still PHP.

The reason these applications do well is because PHP hosting has been widely available for over a decade. Because PHP is on 90% of hosting setups from dedicated systems to cheap $4 a month deals, application developers have targeted PHP to help them reach their highest audience. This makes the hosting companies keep their interest in PHP and its a circular effect that keeps it at the top - even if it’s not the shiniest language in the world.

Sadly, PHP hosts have always been slow to upgrade, which can be attributed to a wide variety of (occasionally fictional) reasons. PHP 5.3 was the worst, with huge companies like Rackspace taking three years to even make PHP 5.3 available as an option on their “Cloud Site” product.

Who cares?

The prominence of specific versions of PHP effects all developers on a scale from “not at all” to “an infuriating amount”. If you work for a company that manages their own servers (be it physical or virtual) then you don’t need to care. I expect you upgraded to PHP 5.3 within a few months of release and you’re probably rocking PHP 5.4 already or at least have a testing server set up to see how your code works.

That is great for you, but distributed application developers are stuck working for the lowest reasonable common denominator. That means every project has to look at their target audience, crunch usage stats and work out where they draw the line. For example, PyroCMS had 23% of its users running PHP 5.2 only 3 months ago. Now I’ve seen that drop to 15% and with MediaTemple and Rackspace Cloud Sites making the jump to PHP 5.3 I can safely say something now that I’ve wanted to say for years:


My personal and professional projects have all been up on Pagoda Box (for better or worse) where 5.3 is an option or EC2 where PHP 5.4 or dev builds of PHP 5.5-dev work just fine if i’m feeling fancy.

The only time PHP 5.2 has ever become a factor for me is working with PyroCMS and occasionally PancakeApp.

Why the noise about a 0.x move?

PHP 5.3 is not a trivial update. If you guys remember, what became PHP 5.3 was originally intended to be PHP 6.0. The dev team hit troubles working out the Unicode support and basically every other feature (Namespaces, anonymous functions, late static bindings, etc) got back-ported and PHP 5.3 was born. It’s thanks to these features that Composer has taken off massively and with PSR-0/1/2 we’re seeing PHP grow up out of its ugly little teenager stage into something considerably more mature.

Well tested, reusable, framework agnostic packages are being built which can be used to build much more stable applications. It’s thanks to this that I can move PyroCMS over to PHP 5.3 and really not be concerned.

  • PyroCMS 2.2 will be out within a few weeks still on PHP 5.2 (no point changing things at the last minute).
  • PyroCMS 2.3 will be using a number of PSR components to clean up the existing code-base (for example, replacing some messy models with Eloquent ORM)
  • PyroCMS 3.0 will be a rewrite, entirely PHP 5.3 using components from Laravel 4.0, a few from FuelPHP 2.0 and a few third party components.

Thanks to most of them supporting at least PSR-1 (where people have complained that camelCase is enforced) all of these components will look and play exactly the same on the outside, so PyroCMS won’t be stuck with some under_score and some camelCase methods. See, this PHP-FIG/PSR stuff is well thought out after-all.

It’s a tough road but it will be possible to walk it without breaking everything. By January 2013 PyroCMS will be PHP 5.3 without losing market share, and the awesome tools being rolled into the core will only improve our uptake as developers rush to play with amazing tools like Monolog, Eloquent, Events and QuickCache.

PHP 5.3 Hosts

I hate it when people try to wrap their own opinions off as fact, so there are plenty of you that will still need to think about whether or not your applications can make the move, and of course you need to weigh up why too - but with so many standard hosting companies offering PHP 5.3 it currently seems silly not to:

More here

All of the hosting companies adopted this at different rates, with Rackspace Cloud and Media Temple only playing catchup in the last month or two. Crucial very proudly told me on Twitter they’ve been supporting PHP 5.3 since July 2011 (2 years after it came out) but they seem on the ball now, and have been supporting PHP 5.4 “since it came out”.

Immediate (but not rushed) or even speedy adoption is all we can ask for. Being stuck with a 4 year lag between release and real-world usage kills me every time.

Wait, cheap PHP 5.4 hosting too?!

There are a few places to get simple PHP 5.4 applications running but not many at this point:

I don’t know of any more, and yes I realise Orchestra is a PaaS and not a standard hosting company, but there are not many PHP 5.4 hosts around so figured I should mention them. Pagoda Box have also been talking about getting PHP 5.4 in and Rackspace are not TOO far from it.

It’ll be another 2 or 3 years before developers can use traits and other cool PHP 5.4 features in distributed applications, but moving to PHP 5.3 is more than enough to totally refresh my love of PHP.

Get in touch

If you represent a hosting company that offers PHP 5.3 or PHP 5.4 hosting let me know on Twitter or in the comments and I’ll update these lists above. Anything I can do to get people off PHP 5.2 literally makes my life better. I’ll be starting the PyroCMS 2.3/develop branch in a week or so then I never have to care about PHP 5.3 again.

If you’re stuck with PHP 5.2, let me know as to why in the comments. For example, I know there are lots of ExpressionEngine users are trapped in 1.6.x and unable to upgrade. EE 1.6.x does badly on PHP 5.3 and upgrading to EE 2.0 is a mammoth task, but they have to upgrade the software at some point - or at least use PHP 5.3 for new projects.

I’d also be really interested to hear from other open-source and distributed app developers, to hear how they’re managing the move.