Why not PHP5?

I saw these two blog posts around the web recently and thought I’d add my two cents.  The core question is “why haven’t you upgraded to php5?”.  I worked at a company that was using PHP5, and also have PHP4 running on my ‘personal’ server which hosts some side projects and a few former clients.  The PHP4 server may likely stay PHP4 simply because it’s running an older version of Plesk, which only supports PHP4.  Upgrading just the PHP on that machine would likely break the stability of the server management, which is otherwise not bad.  There’s precious little software that requires PHP5 that I would want or need to run.  It’s a pretty simple decision.

A company I worked at used PHP5, and it ran without problem.  I did some coding in it, and liked it.  There was nothing particularly compelling about it though, that made me think “I *have* to have this!”.  Indeed, many of the small inconsistencies between early versions of PHP5 made me think twice about its stability.  Early PHP4 had a lot of small bugs/fixes that happened early in its release cycle, but I think more people were starting out with it, rather than upgrading from PHP3, so the incompatibilities to be concerned with were limited to PHP4 for the most part.  Someone upgrading has to worry about the major version incompatibilities *and* be able to keep up with the minor ones as well.

The ‘date’ incident in the PHP5.1 series bugged me quite a bit and really made the question the future stability of the project, which also slowed my reasons for adoption.  I *am* looking at a total server upgrade, which would likely bring the server up to 5.1.2 or 5.2.1 in the next few months, but as there are some existing and functioning sites on the server, it’ll be a chore to test them all.  If I can get things upgraded to plesk8 (or 8.5) it apparently will do some gyrations to allow for PHP4 or PHP5 to be installed on a host, which will simplify things.

That one small issue above – being able to run both simulataneously – is the *primary* reason why PHP5’s adoption has been as slow as it has.  I’m not sure many people chastising people for not upgrading were really on the PHP scene between PHP3 and PHP4.  I was, and the ability to run both on the same server was the primary reason PHP4 was adopted so quickly.  There was no downside to installing PHP4 because server admins could give people time to test their new code without having to stop running their old code.  This article was the first I found just now to demonstrate how. PHP5 does not allow you to run PHP4 in the same Apache space with both versions running as Apache modules, which is how many people like to run it.  Yes, you can use mod_proxy and pass through requests to separate servers running different versions, or run one as a CGI module, but both are less than stellar hacks, and are a step backwards from the PHP3->PHP4 days.  Why this was done, I don’t know.  I imagine it was an attempt to try to force people’s hand to upgrade to PHP5 quickly.  If so, it’s failed miserably.  Perhaps if the XML support hadn’t completely changed, that might have made it easier for people to upgrade.  Additionally, offering a compatibility layer so old XML functions would map to new XML functions with an INI switch or an extra set of alias functions in the new XML function set library would have made upgrading easier for people that had invested heavily in apps that made practical use of XML in PHP4.

I could go on a bit more, but I think you get my point.  PHP5 offers some reasons to upgrade, but the server admin hassle and incompatibilities are enough to make most people think twice.  If I was recommending someone starting off today building apps for internal or hosted use, I’d certainly recommend PHP5.  But many people aren’t starting fresh – they’ve got existing code to deal with, and the decision to upgrade is not as cut and dried as many PHP5 cheerleaders make it out to be.

I'm currently working on a book for web freelancers, covering everything you need to know to get started or just get better. Want to stay updated? Sign up for my mailing list to get updates when the book is ready to be released!

Web Developer Freelancing Handbook

Leave a Reply