Windows PHP installation file thread-safe and non-thread-safe differences _php Tips

Source: Internet
Author: User


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. With thread-safe versions, however, it is only possible to cross a thread without affecting the security of the entire IIS.

Of course in IIS under the CGI mode is the most secure way to run PHP, but the CGI mode for each HTTP request needs to reload and uninstall the entire PHP environment, its consumption is enormous. To take into account the efficiency and security of PHP under IIS, someone gave a fastcgi solution. 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.

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.

Attachment: Excerpts from questions related to Germany

When downloading the PHP installation file, I see two different binaries, such as Non thread safe and thread safe, such as the one listed on this page: http://windows.php.net/download/. What does this mean, what's the difference?

This is primarily for Web server, in Windows, if you are using a Web server that is Apchae or IIS 7, you should select a thread-safe installation file, and if you use fast-cgi mode, You can choose to be not thread safe, because the Web sever itself guarantees thread safety.
Of course, there are binaries. Compilers used at compile time: Vc9 (vs series) VC6 (GCC)

As you said upstairs, it's for Web server, and some Web servers handle application requests in a multi-threaded rather than a multiple process way, Threading method because it involves sharing registers and memory, so it is easy to error, this time the program will need to spend some additional experience to deal with the data consistency in registers, that is, to ensure thread safety.
So whether thread safety is the main way to look at the PHP request processing that your Web server uses, if it is multithreading, select thread-safe, otherwise it is not thread-safe, as the upstairs said Fast-cgi way to select non-thread-safe

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.