What version of PHP is considered “Standard” for most web hosts? [closed]

放肆的年华 提交于 2019-12-23 15:05:02

问题


I have been surprised to learning that a number of my hosted sites only support 5.1.6, when my dev box is running 5.3.x. This is a huge disappointment, because I've been working with namespaces (5.3+) and other features that seem to me to be excellent, if not strictly necessary.

Anyway, when writing code that is designed to be portable (eg: plugins for popular platforms like WordPress), what version of PHP should I be targeting, based on the minimum version that's supported on the majority of web hosts out there.

Does anyone know? How can one find out?


回答1:


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

It contains a lot of PHP stats. As of 12 Dec 2012,

  • Version 5 is used by 96.4% of all the websites which use PHP.
  • Version 5.3 is used by 42.3% of all the websites which use PHP version 5
  • Version 5.2 is used by 52.8% of all the websites which use PHP version 5



回答2:


My godaddy hosting account is on 5.2.17. If you want code to be portable then I would go with a general baseline of 5.0 features, which is pretty big feature set.




回答3:


Anyway, when writing code that is designed to be portable (eg: plugins for popular platforms like WordPress), what version of PHP should I be targeting, based on the minimum version that's supported on the majority of web hosts out there.

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 to PHP 5.2.4 and MySQL 5.0. So just check the according website of the project you would like to code for.



来源:https://stackoverflow.com/questions/6310419/what-version-of-php-is-considered-standard-for-most-web-hosts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!