Thread Safe(TS) and Non Thread Safe(NTS) - What are they, what’s the difference?

Asked

Viewed 10,637 times

8

When someone goes to download PHP, they have these 2 options: ts and nts, as well as language extensions. My doubts are as follows::

  • What are Thread Safe(TS) and Non Thread Safe(NTS)?
  • There are some differences between them?
  • Each is recommended for what kind of development

1 answer

14


From the PHP documentation:

Thread Safety means that the binary can work in a context of multi-segment server such as Apache 2 in Windows. Thread Safety works by creating a local storage copy in each segment, so that the data does not collide with another segment.

So, what do I choose? If you choose to run PHP as a CGI binary, so you won’t need to thread Safety, because the binary is called in each request. For web servers multithreaded, such as IIS5 and IIS6, you should use the chained version( threaded version) of PHP.

So it really depends on the way you want to use PHP:

Apache + Loadmodule: thread-safe
Apache + Fastcgi: Non-thread-safe
IIS: thread-safe
IIS + Fastcgi: Non-thread-safe

The Manual for PHP has more very interesting instructions.

Source, Source 2, Source 3 (Outside SO)

  • IIS uses NTS version, because it only runs in FASTCGI mode

  • What are these "segments"?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.