What’s keeping you from PHP5?

Share this article

First up: as an in-house SitePoint’s PHP coder/waterboy, I’m stepping in for Harry as a guest blogger while he digs his way out from the February Zurich snowfall. Hopefully we’ll see him back and all thawed out soon ;-)

What’s keeping you from PHP5? For me this question applies on three fronts. It encompasses work we do on SitePoint’s PHP codebase, work we undertake for clients’ projects and tinkering I do in my spare time.

Only in the latter – the 2am toiling PHP geeks promise to do during the swearing in ceremony – have I made any semblance of a switch to PHP5. SitePoint.com is firmly entrenched in PHP4, even though PHP5 offers many enhancements I’d like to take advantage of.

I suspect many, indeed most, large scale custom built websites using PHP are still running on PHP4 with no plans (short term at least) toward making the switch. In fact – perhaps because it’s my first blog – I won’t throw unfounded claims into the wind; so let’s have a look:

X-Powered-By: PHP/4.3.3-dev

X-Powered-By: PHP/4.3.11-dev

X-Powered-By: PHP/4.3.8

Friendster is an interesting one, given their much publicized – and comparatively recent – switch from JSP to PHP.

Surely if there’s ever a time to hop onboard PHP5’s sublimely object-oriented and exception-handled bandwagon it’s during a ground up re-write?

The fact that php.net is still running PHP 4 is telling indeed. Haven’t managed to find any gossip as to why, perhaps someone knows something about this?

Our experience is likely very similar to other long-running PHP powered websites; we have a large codebase, much of it affectionately described as “legacy”.

In and of itself, though, this isn’t the problem. PHP5/PHP4 compatibility is near perfect until you hit some of the stickier areas of objects and references. These, too, can be fixed easily enough, though it’s likely to be nearly impossible to hunt down all the snafus before going live. Just like any new software release, really, incompatibilities are to be expected.

The real trouble arises when you encounter more esoteric incompatibilities; ones which cannot be readily predicted or spotted without a certain combination of programmatic states. A case in point I encountered while trying to get WordPress running on PHP5.

“Where are the unit tests?” I hear Harry thinking…

PHP of course can’t be blamed for this situation. A bug is a bug, relying on “undefined behavior” is never good practice. But these are the scenarios which can be almost overwhelming in a large scale application that has evolved with PHP as the language has matured.

I don’t remember feeling such friction when we switched from PHP3 to PHP4. I think key to this was the relative simplicity with which we could run PHP3 and PHP4 within a single Apache installation. Unfortunately the same can most definitely not be said for PHP5.

On a personal server box I share with some fellow SitePointers we (perhaps naively) elected to go with PHP5, and I’m pretty much at the point of getting additional IP addresses so I can run an entirely separate Apache process for PHP4.

PHP5 has much of what I want; it’s the premium beer at the minute, but all told I can’t yet make the switch.

So what’s stopping you? And what large sites out there are using PHP5?

Jules SzemereJules Szemere
View Author
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form