Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save albertpark/6a30cb6aa4688a2c13c2f3e1cbbff13e to your computer and use it in GitHub Desktop.
Save albertpark/6a30cb6aa4688a2c13c2f3e1cbbff13e to your computer and use it in GitHub Desktop.

PHP Difference between Thread Safe and Non-Thread Safe for Windows

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:

Apache + LoadModule: Thread Safe
Apache + FastCGI: Non-Thread Safe
IIS: Thread Safe
IIS + FastCGI: Non-Thread Safe

https://stackoverflow.com/a/7204804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment