Windows PHP, Apache version Select the explanation

Source: Internet
Author: User

Each time you install PHP development environment is always more or less confused a bit, today to comb the relationship between apache,php (according to http://www.ituring.com.cn/article/128439, Add. )

Both 1.apache and PHP are compiled by Visual Studio.

So we often encounter the confusion of choosing Vc6/vc9/vc11. PHP is not officially recommended to install Apache binary installation packages downloaded from the apache.org website under Windows. The reason is that these packages are compiled based on outdated visual Studio 6, and you have to use the same old PHP version (that is, the PHP version of VC6). That is, the PHP version compiled with Visual Studio 6). The official PHP recommendation is that you can use IIS under Windows, or use the Apache version from the Apache Lounge (www.apachelounge.com).

2.windows PHP chooses thread-safe or non-thread safe.

To understand this problem, the first thing to do is to look at the selected server, based on the selected server and how PHP works, and then decide the choice of PHP . Under Windows We can choose IIS or Apache.

1. PHP works in two ways when using IIS:

2.1 ISAPI you should use PHP's thread-safe version (thread safe,ts). The reason is that 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.

2.2 fastcgi should use a non-thread-safe version of PHP (Non-thread safe,nts). The reason is that when PHP is installed in fastcgi, PHP has a separate process, and the 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. There are three ways to work with Apache:

It is also important to note here that although Apache itself is thread -safe and you have chosen a thread-safe version of PHP, some third-party extensions under Apache and PHP were originally developed based on UNIX's multi-process thinking, There is no thread-safety concern when designing the development, so it is not ruled out that IIS is still being crashed by some third-party extensions in this case.

2.1 Module 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.

The 2.2 ISAPI generally considers ISAPI to be used with IIS because the ISAPI was originally developed by Microsoft for IIS. But Apache can now also implement the ISAPI functionality by loading the mod_isapi.so module to allow PHP to be installed in an ISAPI manner. The so file is a module naming convention that has been developed by Apache since version 1.3 for Windows, and for Apache under Windows,. So is a dynamic-link library file, as is the. dll file.

When you want to install PHP in an ISAPI fashion, you typically load a DLL file named PhpXisapi.dll, where X is Arabic numerals 4, 5, and so on.

However, it is generally not recommended to install PHP in Apache as an ISAPI, because so far, the ISAPI functionality implemented by Apache through the Mod_isapi.so module is incomplete and does not fully implement all the specifications Microsoft has set for ISAPI. Similarly, PHP does not have a separate process for installing PHP as an ISAPI, and it is also loaded into Apache as a module, so it is also necessary to use the thread-safe version of PHP.

2.3 FastCGI If you are using PHP in FastCGI mode in Apache, you should use PHP's non-thread-safe version, as is the case with 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.

Windows PHP, Apache version Select the explanation

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.