How do you choose the PHP version? Which version should I use? _php Tips

Source: Internet
Author: User
Tags http request

More than 75% of Web sites use PHP as a development language, and the popularity of wordpress,phpmyadmin and other Open-source projects has led to a slew of long tail users. However, they are typically installed but rarely upgraded. The following figure is the current usage statistics for PHP.

Amazingly, the left half of the graph represents a PHP version that has not been supported. PHP 5.2 was no longer maintained as early as January 2011. This doesn't mean you can't use it, but that means some security updates and you can't follow up. Some distributions will try to fix some bugs, but your PHP version seems a bit lackluster because you're using outdated technology from 2006.

Where do I start?

No one has chosen PHP version 5.2, but these things have happened, but I'm not saying that I'm writing this blog to spit out anything, let alone give you some guidance on how to upgrade. Typically they are using some 2006 of the starting host space, they have a "long term support" version to avoid using newer versions, or they have no plans to upgrade yet. Or, there are really a lot of reasons. However, good things are waiting for you in the new version of PHP.

PHP 5.3 has added a lot of useful OOP features! For example: Anonymous functions, SPL extensions are not just iterators, and fabulous datetime extensions are already integrated into PHP 5.3. Also adds the extremely important e_deprecated error reporting flag. It will remind you of the features you are using and will not be available for the next version. If you are already using PHP 5.3, your upgrade path will be smoother. If you have a wired program running in a lower version, I do not recommend that you upgrade.

PHP 5.4 A series of optimizations that have faster execution efficiencies and less memory footprint. The following are the results of the benchmark test.

Whether you use the traits feature, PHP 5.4 improves program performance and lowers hardware costs. So, I recommend that you keep upgrading when you use open source software.

PHP 5.5 is still being tested and does not apply to production environments. Since PHP 5.3, the risks and changes to the upgrade will be greatly reduced.

The following is the wheat classmate finishing the article

Everyone in the selection of PHP version must be very confused, there are so many versions of the choice?

Problem:

We are now buying a new server with Windows Server 2008 R2. Configure the environment for PHP 5.4.

But we have previously developed the use of 2003,php is a 5.2 version of the porting to the new server, the program run will affect it? Or do I have to pay attention to those problems?

API version

PHP with a large version of backward-compatible upgrade, that is, 5.5 compliant 5.1-5.4, but in fact, compatibility is not optimistic, we do not expect the official PHP will give a good solution. Now in September 2013, the version has 5.2.17 5.3.27 5.4.17 5.5.3

5.2.17

This version can be said to support the most extensive version, now there are most open source software to use this version, such as drupal7.23,joomla2.5, the vast majority of domestic software: dedecms5.7, DISCUZX3, etc. the latest version is still supporting 5.2, if no special requirements, installation of this version is the most hassle-saving, but in the long run may end up being abandoned. Now many hosts in order to save labor cost also lazy to upgrade PHP version, anyway basically support. (here to insert a sentence, now the domestic software in order to compatible with more installation environment, is well-intentioned, even PHP5.1 can support (discuzX3 do not support), the most rare is not even behind the performance of how much, can do as some extreme really not easy! ) DRUPAL6 recommends using this version.

5.3.28 (recommended)

This version, though the name is a 5 start, But many people think it's the beginning of the PHP6.0 version, performance has improved, and because many APIs have changed, 5.2 compatibility is not very good, although some open source software claims to be compatible with 5.2-5.3, but the problem seems to be many, many simply give up 5.2, such as JOOMLA3 only support more than 5.3. For Drupal7 It is strongly recommended to use this version and support is fairly good. This version is also available for Drupal8, and support is pretty good. This version uses a wide range of features to make a good balance between performance and compatibility.

5.4 (lightly recommended)

5.4 Basically has been close to the whole, now relatively perfect, stability and performance is also good, the next major version of the upgrade, drupal7.x support is fair, but the third party module is not perfect. If you are lazy to upgrade later, you can install the version one-step.

5.5

From 5.3 onwards, the later version is basically the main performance of the promotion, functions and anything can be backwards compatible. 5.5 seems to have a 64-bit version, more robust performance, I did not try, do not dare to make comments.

Summarize

If open source software says the proposal installs PHP5.3, then you honestly use 5.3, do not use 5.5 what, you may think that can be compatible anyway, performance may be better, why not new? That said, but you know that open source software in the development of the general is in a specific environment development, even if the compatibility of the good will have unexpected surprises (again a strong team will not be able to all the function API compatibility test, it is quite a terrible workload!) , it will only be tested and optimized in a specific environment, and even if the compatibility problem is known, the team will not be able to modify it in order to be compatible with the newer version, not because they are inflexible, but to be considered for security and stability. In the open source environment, we should have a sense that "enough is the best", not "the latest is the best." For example, Joomla3.1 in 5.4-5.5 are running bad, and even installation can not succeed. But Drupal is also operating under the 5.5.3 (this machine), I think it is an individual case? But it seems that there have been unexpected errors in the operation, do not know whether the version of the problem, I hope not.


None-thread-safe or Thread-safe

Apache General Election None-thread-safe,iis Choose the latter (fast-cgi), I will not explain, letter brother is right.

TS refers to thread Safety, which is typically selected when IIS is loaded as ISAPI.

NTS is None-thread Safe, which is typically run in fast CGI, with better performance.

The first Windows version of PHP3.0.17, released on October 20, 2000, started with a thread-safe version, because the Windows system is a multithreaded way of working with the Linux/unix system, which uses multiple processes. Running PHP in CGI under IIS can be very slow because the CGI pattern is based on multiple processes, not multithreading. Normally we would configure PHP to run as an ISAPI, and ISAPI is a multithreaded way, which is much faster. There is a problem, however, that many of the commonly used PHP extensions are developed with Linux/unix ideas, which can cause errors to take down IIS when they run in the ISAPI mode. Therefore, the CGI mode is the safest way to run PHP under IIS, but the CGI model needs to reload and uninstall the entire PHP environment for each HTTP request, and its consumption is enormous.

To accommodate the efficiency and security of PHP under IIS, Microsoft has fastcgi solutions. FASTCGI allows PHP processes to be reused rather than to restart a process with every new request. FastCGI can also allow several processes to execute at the same time. This solves the problem that the CGI process mode consumes too much, and utilizes the advantage that the CGI process mode has no thread security problem.

Therefore, if you are using ISAPI to run PHP you must use the thread safe version, while running PHP in fastcgi mode does not require thread safety checks, with none thread safe (NTS, non-threading security) Version to better improve efficiency.

64-bit and 32-bit

Your system is 64-bit to choose 64, is 32 to choose 32, do not explain, letter brother.

Future

To tell the truth, the future belongs to those who use PHP5.4 and above. Maintaining upgrades and regularly tracking the new features and progress of the language is part of our daily work. If you are already behind, then I strongly recommend that you start your upgrade plan and upgrade to a newer version. The effort is worthwhile, after all, the program is running for ages.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.