What version of PHP is considered "standard" for most web hosts?

I was surprised to learn that several of my hosted sites only support 5.1.6 when 5.3.x works in my dev block. This is a huge disappointment because I worked with namespaces (5.3+) and other functions that seem excellent to me, if not strictly necessary.

In any case, when writing code that is designed for portability (for example: plugins for popular platforms such as WordPress), which version of PHP should be configured based on the minimum version supported on most web hosts.

Somebody knows? How to find out?

+4
source share
3 answers

Check out http://w3techs.com/technologies/details/pl-php/all/all .

It contains a lot of PHP statistics. As of December 12, 2012 ,

  • Version 5 is used by 96.4% all websites that use PHP.
  • Version 5.3 is used 42.3% for all sites using PHP version 5
  • Version 5.2 is used by 52.8% for all sites using PHP version 5
+8
source

My hosting account on the site is 5.2.17. If you want the code to be portable, I would go with a common base of 5.0 functions, which is a fairly large set of functions.

+1
source

In any case, when writing code that is designed for portability (for example: plugins for popular platforms such as WordPress), which version of PHP should be configured based on the minimum version supported on most web hosts.

When you write for a specific platform, check the system requirements of that platform. For example, Wordpress 3.1 supports PHP 4.3 and MySQL MySQL 4.1.2. The next version 3.2 will increase this value to PHP 5.2.4 and MySQL 5.0. So just check the appropriate website of the project for which you want to code.

+1
source

All Articles