How to select the appropriate PHP version

Source: Internet
Author: User

How to select the appropriate PHP version

There are many PHP versions, including 32-bit 64-bit and thread-safe and non-thread-safe php versions. How should I select the PHP version?

 

PHP32 and 64


32-bit php integer data at least plus or minus 2 GB (0x7FFFFFFF)
64-bit php integer data up to 9 hundreds of thousands of TB (0x7FFFFFFFFFFFFFFF)
Website code often needs to pay attention to the limit value of integer data.

Version Selection
If yourPC/ServerIt's a 32-bit version.
If it is 64-bit, install the x64 version.

PHP thread security and non-thread security options and differences.
Note: After PHP5.3, PHP will no longer have the ISAPI mode, and the php5isapi. dll file will no longer exist after installation.
In Windows, PHP versions 5.2.1 start with Thread Safe (Thread security) and None Thread Safe (ETS, non-Thread security,
PHP versions in Windows are classified into two types: thread-safe version and non-thread-safe version. Thread-safe and non-thread-safe versions are only applicable to windows, but not linux.

So what is the difference between the two? What should I use? For a brief introduction.

If you use ISAPI to run PHP, you must use the Thread Safe version;

If you run PHP In FastCGI mode, there is no need to use Thread security check. Using the None Thread Safe (CNT, non-Thread security) version can improve the efficiency.


It is difficult to describe the differences between the two. from the user's point of view, remember the differences between the two versions.

1. windows + IIS + FastCGI: Use a non-thread-safe version.
Reason:
When PHP is installed in FastCGI mode, PHP has an independent process and FastCGI is a single thread, there is no mutual interference between multiple threads (this interference is usually caused by global variables and static variables ). Because thread security check is not required, FastCGI is more efficient than ISAPI.


Thread Safe Thread security

Non Thread Safe Non-Thread security (not officially recommended for actual production)

 

2. windows + IIS + ISAPI: Use the thread-safe version.
Reason:
When PHP is installed using ISAPI, PHP does not have an independent process, but is loaded and run as a DLL by IIS, that is, it is attached to the Web server process. When the Web server runs in multi-threaded mode (this is the case for IIS), PHP naturally runs in multi-threaded mode. As long as it runs in multi-threaded mode, there may be thread security issues. Therefore, select the PHP thread security version.

3. windows + Apache + PHP (module): Use the thread-safe version.
Reason:
If you want to install PHP through modules in Apache, you should use the thread-safe version of PHP. The reason is that when PHP is installed as an Apache module, PHP does not have an independent process, but is loaded into Apache as a module in the form of DLL, Which is started with Apache startup, in Windows, Apache is used in multi-thread mode, so PHP runs in multi-thread mode. Therefore, the thread-safe version of PHP should be used in this case.

4. windows + Apache + PHP (ISAPI): Use the thread-safe version.
Reason:
When using ISAPI to install PHP, PHP does not have an independent process and is loaded into Apache as a module. Therefore, PHP's thread-safe version is also required.
It is generally not recommended to install PHP using ISAPI in Apache, because up to now, the ISAPI functions implemented by Apache through the mod_isapi.so module are incomplete, microsoft has not fully implemented all the ISAPI specifications.

5. windows + Apache + PHP (FastCGI): Use a non-thread-safe version.
Reason:
If you want to use PHP in Apache using FastCGI, you should use a non-thread-safe version of PHP in the same way as PHP in IIS using FastCGI. The reason is that when PHP is installed using FastCGI in Apache, PHP has an independent process and FastCGI is a single thread. Therefore, PHP's non-thread-safe version should be used to improve performance.

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.