PHP installation files under Windows thread-safe and non-thread-safe Differences _php Tutorial

Source: Internet
Author: User
The first Windows version of PHP3.0.17, released on October 20, 2000, started with a thread-safe version, because unlike the Linux/unix system, which works in a multi-process manner, Windows systems work in a multi-threaded way. It is very slow to run PHP as CGI under IIS, because the CGI pattern is built on a multi-process basis, not multithreaded. In general, we will configure PHP to run in ISAPI way, ISAPI is multi-threaded way, so much faster. There is a problem, however, that many commonly used PHP extensions are developed with Linux/unix's multi-process thinking, which can be faulted when running in ISAPI mode. With a thread-safe version, it's more about a thread than it does on the entire IIS security.

Of course, under IIS, CGI mode is the safest way to run PHP, but CGI mode requires a reload and unload of the entire PHP environment for each HTTP request, and its consumption is enormous. In order to take into account the efficiency and security of PHP under IIS, someone has given the fastcgi solution. FastCGI can allow the PHP process to be reused instead of every new request to re-open a process. FastCGI can also allow several processes to execute simultaneously. This solves the problem that the CGI process pattern consumes too much, and the CGI process pattern does not have the advantage of the 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, there is no need to use thread security, with none thread safe (NTS, non-thread-safe) 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, there is no need to use thread security, with none thread safe (NTS, non-thread-safe) Version to better improve efficiency.

Attached: Excerpts from questions related to German ask

When I download the PHP installation file, I see two different binaries, like non-thread safe (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 a Windows environment, if you are using a Web server that is Apchae or the following version of IIS 7, you should choose a thread-safe installation file, and if you use fast-cgi mode, you can choose non-thread-safe because The Web sever itself guarantees thread safety.
And, of course, the compiler used by the binaries compile: Vc9 (VS series) VC6 (GCC)

As said upstairs, for Web server, some Web server processing application requests is multi-threaded rather than multi-process approach, threading method because it involves the sharing register and memory, so it is easy to error, At this point the program needs to spend some extra time dealing with data consistency in the register, which guarantees thread safety.
So whether the use of thread safety mainly depends on your Web server PHP request processing method, if it is multithreaded processing, then choose thread-Safe, otherwise choose non-thread-safe, such as the upstairs said Fast-cgi way can choose non-thread-safe

http://www.bkjia.com/PHPjc/759968.html www.bkjia.com true http://www.bkjia.com/PHPjc/759968.html techarticle The first Windows version of PHP3.0.17, released on October 20, 2000, started with a thread-safe version, which is due to the fact that the Linux/unix system is working in a multi-process manner that is different from wind ...

  • Related Article

    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.