Software Development

Choose a minimum PHP version

Ok, you are about to code a great new application in PHP, that will be downloaded millions of times and be installed on shared servers all over the world. Being the cutting edge developer you are, you will use all the latest PHP features like closures and namespaces. What is stopping you from world domination?

In the world of shared hosting, users don’t have influence on their version of PHP. That is up to the host, and that depends on the operating system and distribution they are using. Many developers may have their dev machines near the bleeding edge, but this is not universally true.

At the time of writing, the current stable PHP versions are 5.3.2 & 5.2.13. WordPress the widely deployed blogging system still maintains a minimum requirement of PHP4.3+ but discussion on the WPDevel is going on regards leaving PHP4 behind, and which PHP5 version to move too. From their own stats on WP installs, 85.4% use PHP5.2.

GoPHP5 recommended back in 2008 that all PHP projects move to a minimum of 5.2 for stability and performance reasons.

So what is a good choice for a minimum PHP version to expect your app users to have?

Most shared hosting uses a Linux or Unix distribution and that will have a version of PHP as some style of package to be installed. Of course they could do a customised install, but most will stick close to the supplied version for reasons of stability and support. The major distributions used are RHEL/CentOS, Debian or FreeBSD. These are all solid server installs that aim to provide a very stable environment over a cutting edge. This will cover most but not all hosts.

The following distribution and PHP version come from distrowatch.

RHEL/CentOS

CentOS 5.5, 4.8, 3.9 are all still officially supported, but most hosts are are in the 5.x series. Centos 5.x has PHP 5.1.6 in its official repository, 4.x has PHP 4.3.9 & 3.x has 4.3.2.

Debian GNU/Linux

Versions Lenny (5) and Etch(4) are the versions in use, though Etch is now officially out of support. Etch uses a modified version of PHP 5.2.0 and Lenny has 5.2.6.

FreeBSD

FreeBSD 8 & 7.3 are currently supported versions. FreeBSD 7 has PHP 5.2.11 and 7.3 has 5.2.12.

From the above, I would say requiring a minimum PHP version of 5.2 will not restrict many users installing your software, and still allow scope for world domination.

Standard