If you’ve been working with PHP for a while, you’ll be aware of the use of two major versions of PHP: version 4 and version 5. Of course, version 4 was released years ago, support for it was dropped recently and everyone is encouraged to upgrade to version 5. Version 6 has been in the works for quite a while as well. So why are so many hosts still restricting users to PHP 4?
If you purchase a cheap hosting account with many of the major web hosts around today, chances are they will be running PHP 4. The problem for web hosts is this: the PHP community may have moved on from version 4, but a lot of the code out there hasn’t.
Most of the cheap web hosts (those exploiting economies of scale) aim for the less professional PHP users; the amateur webmasters, the experimenters, the children even (I know a ten year old who has trouble with PHP versions). If they upgrade to PHP 5, they alienate a significant portion of their user base and render redundant all that existing code. They also have to brace for support overheads; people will start asking why their code no longer works.
The typical solution is to offer both PHP 4 and PHP 5. DreamHost offers this, with a simple domain-specific switch in the control panel. However, most of these hosts use cPanel- or Plesk-oriented architecture and server design, which does not easily allow for PHP version switching. There’s also the added overhead of maintaining two versions, deploying updates and patches to both, and the security risk that comes with running any additional software.
The only real solution is for all the major projects to explicitly require PHP 5. Quite a few do, with an installation check warning that PHP 5 is essential. Yet, without the support of the hosts, it’s a catch 22: either the hosts upgrade and lose customers, or the developers upgrade and lose users. Each side is slowly moving forward; the GoPHP5 project is helping speed up the transition a little.
Of course, after a point PHP 5 will reach critical mass among developers and so many apps will require PHP 5 that hosts will have no choice. Have we reached that point yet? Maybe. If not, it won’t be far off. In the meantime, we can only keep posting “Please upgrade” notices all over our software when we see a PHP 4 server. Happy coding.