Windows PHP thread safety and insecurity, two versions I can not read, write down to say.

Source: Internet
Author: User
Tags install php

There are two versions of PHP under Windows: The thread-safe version and the non-thread-safe version.

To discuss the difference between the two, detailed talk about the trouble, from the user's point of view, remember when to use which version of the difference is OK:

1. Windows + IIS + FastCGI: Use a non-thread-safe version.

Explain:

When PHP is installed in fastcgi, PHP has a separate process, and fastcgi is a single thread, and there is no mutual interference that can arise between multiple threads (usually caused by global variables and static variables). Because of the absence of thread-safe checking, the use of the FastCGI method is more efficient than the ISAPI approach.

2. Windows + IIS + ISAPI: Use the thread-safe version.

Explain:

When PHP is installed in ISAPI mode, PHP does not have a separate process, but is loaded as a DLL by IIS, which is attached to the Web server process. When the Web server is running in multithreaded mode (this is the case with IIS), PHP naturally runs in multithreaded mode. As long as you are running in multithreaded mode, there may be a thread safety issue, so you should choose a thread-safe version of PHP.

3. Windows + Apache + PHP (module): Use the thread-safe version.

Explain:

If you want to install PHP as a module in Apache, you should use a thread-safe version of PHP. The reason is that when PHP is installed as an Apache module, PHP does not have a separate process, but as a module in the form of a DLL loaded into Apache, is launched with the Apache boot, and Windows Apache is multithreaded mode of operation, So PHP naturally runs in multithreaded mode as well. Therefore, the thread-safe version of PHP should be used in this case.

4. Windows + Apache + PHP (ISAPI): Use the thread-safe version.

Explain:

Since PHP is installed in ISAPI mode, PHP does not have a separate process and is loaded into Apache as a module, so it is also necessary to use the thread-safe version of PHP.

In general, it is not recommended to install PHP in an ISAPI manner in Apache, because so far, the ISAPI functionality that Apache has implemented through the Mod_isapi.so module is incomplete and does not fully implement all of the specifications Microsoft has set for ISAPI.

5. Windows + Apache + PHP (FastCGI): Use a non-thread-safe version.

Explain:

If you are using PHP in fastcgi mode in Apache, you should use PHP's non-thread-safe version as in the case of PHP with fastcgi in IIS. The reason is that when PHP is installed in Apache in fastcgi mode, PHP has a separate process and fastcgi is a single thread, so you should use a non-threaded version of PHP to improve performance.

The above information to summarize the relevant information, sub-line details, for selection.

Windows PHP thread safety and insecurity, two versions I can not read, write down to say.

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.