I am downloading PHP for Windows. I got 2 options on the website.
Please answer the following questions:
It refers to a single thread only builds. In non-thread safe version binaries widespread use in the case of interaction with a web server through the FastCGI protocol, by not utilizing multi-threading. For example: Apache + FastCGI. IIS + FastCGI.
Conditionally safe: Different threads can access different objects simultaneously, and access to shared data is protected from race conditions. Not thread safe: Data structures should not be accessed simultaneously by different threads.
The difference of NTS and TS is in the name itself. TS = Thread Safe. NTS = Non Thread Safe. Though the non checking of thread safty the NTS version is a very little faster.
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).
From PHP documentation:
Thread Safety means that binary can work in a multithreaded webserver context, such as Apache 2 on Windows. Thread Safety works by creating a local storage copy in each thread, so that the data won't collide with another thread.
So what do I choose? If you choose to run PHP as a CGI binary, then you won't need thread safety, because the binary is invoked at each request. For multithreaded webservers, such as IIS5 and IIS6, you should use the threaded version of PHP.
So it really depends on the way that you want to use PHP:
LoadModule
: Thread SafePHP manual has nice installation instructions.
AFAIR running PHP with FastCGI is the preferable way, it performs faster and allows for more fine-grained security configuration.
Quick and simple: If you are using Apache edit your Apache24\conf\httpd.conf file and search for "loadmodule". If you see your loadmodule is referencing a .dll something like:
LoadModule php7_module "e:/x64Stack/PHP/php7.1.9/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "e:/x64Stack/PHP/php7.1.9"
Then you want Thread Safety enabled or TS - Thread Safe version.
Else if you are using IIS or Apache with CGI then NTS flavor.
I use multiple stacks and within those multiple servers and versions of PHP so don't let the paths / php or server versions throw you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With