Windows version of PHP starts with thread safe (thread safety) and none thread safe (NTS, 5.2.1), which is different from version. What kind of it should be used. Here's a simple introduction.
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. Therefore, the CGI mode is the safest way to run PHP under IIS, but the CGI model needs to reload and uninstall the entire PHP environment for each HTTP request, and its consumption is enormous.
To accommodate the efficiency and security of PHP under IIS, Microsoft has fastcgi solutions. FastCGI can make the PHP process heavy
Reuse rather than each new request to restart a process. FastCGI can also allow several processes to execute at the same time. This solves both
The problem of the CGI process mode consumption is too large, and the use of the CGI process mode does not exist the advantage of thread security problems.
Therefore, if you are using ISAPI to run PHP, you must use the thread safe version;
fastcgi mode to run PHP there is no need for thread security checks, with none thread safe (NTS, non-threading safety)
Version to better improve efficiency.
PHP official http://php.net/on widows version of 4: VC9 x86 Non thread SAFE,VC9 x86 thread SAFE,VC6 x86 Non thread SAFE,VC6 x86 thread SAF e; So what's the difference?
This is the runtime dependencies on the Windows system
PHP is developed in C language so rely on VC library to run
Visual C + + 2003 runtime (VC7) Visual C + + 2005 Runtime (VC8) Visual C + + 2008 Run-time Library (VC9) Visual C + + 2010 Runtime (VC10) Visual C + + 2012 Run-time Library (V C11 Visual C + + 2013 Runtime (VC12) only the appropriate runtime is installed to run PHP, such as php5.5 requirements VC11 installation
2. Different modes of operation
PHP operates in 2 ways: ISAPI and fastcgi.
ISAPI execution is in the form of DLL dynamic library, can be executed after the user request, after processing a user request will not disappear immediately, so the need for thread security checks, so as to improve the efficiency of program execution, so if you are using ISAPI to execute PHP, it is recommended to select thread Safe version;
The fastcgi execution is done with a single thread, so there is no need for thread security checks, and the removal of thread security checks can improve execution efficiency, so if you are fastcgi to execute PHP, it is recommended that you choose non thread safe version.
typically choose ISAPI for Apache servers, and fastcgi for nginx servers.