None-Thread Safe就是非線程安全,在執行時不進行線程(thread)安全檢查;
Thread Safe就是線程安全,執行時會進行線程(thread)安全檢查,以防止有新要求就啓動新線程的 CGI 執行方式耗盡系統資源。php
再來看PHP的兩種執行方式:ISAPI和FastCGI。
FastCGI執行方式是以單一線程來執行操做,因此不須要進行線程的安全檢查,除去線程安全檢查的防禦反而能夠提升執行效率,因此,若是是以 FastCGI(搭配IIS)執行 PHP ,都建議下載執行 non-thread safe 的 PHP (PHP 的二進位檔有兩種包裝方式:msi 、zip ,請下載 zip 套件)。
而線程安全檢查正是爲ISAPI方式的PHP準備的,由於有許多php模塊都不是線程安全的,因此須要使用Thread Safe的PHP(搭配apache)。web
若是你還搞不清楚,那麼只需知道你是php+apache仍是php+iis組合
non-thread-safe 非 線程安全與IIS搭配環境
thread-safe 線程安全 與apache搭配環境apache
If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.安全
Please use the Apache builds provided by Apache Lounge. They provide VC9, VC11 and VC14 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.ide
If you are using PHP as module with Apache builds from apache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOT use VC9+ versions of PHP with the apache.org binaries.ui
With Apache you have to use the Thread Safe (TS) versions of PHP.spa
More recent versions of PHP are built with VC9, VC11 or VC14 (Visual Studio 2008, 2012 or 2015 compiler respectively) and include improvements in performance and stability.線程
- The VC9 builds require you to have the Visual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installedorm
- The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installedserver
- The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed
TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).