Thread-safe: It is used to ensure that when the shared data structure which is manipulated by different threads are prevented from entering the race condition. Thread-safety is recommended when the web server run multiple threads of execution simultaneously for different requests. In Thread Safety binary can work in a multi-threaded web server context. Thread Safety works by creating a local storage copy in each thread so that the data will not collide with another thread.
- Apache + LoadModule
Non-thread-safe: It does not check the safety of the threads which makes it faster to run but at the same time, it becomes more unstable and crashes very frequently. 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.
- Apache + FastCGI
- IIS + FastCGI
So it depends on the way that you want to use PHP. AFAIR running PHP with the fastCGI is the preferable way. If you are unknown which version of PHP is installed in your system then there is an easy way to know that.
Check the version of installed PHP Thread safe or Non Thread Safe:
Open a phpinfo() and search for the line Thread safety for a thread-safe build you should find enable.
- On Windows:
php -i|findstr "Thread"
- On *nix:
php -i|grep Thread
- In the both cases will display any one
Thread Safety => enabled //or Thread Safety => disabled
- Python | Different ways to kill a Thread
- How to Create ToDo App using HTML, CSS, JS and Bootstrap ?
- Node.js | fs.truncateSync() Method
- Node.js | fs.ftruncateSync() Method
- Check if N-factorial is divisible by X^Y
- How to Design Color Picker using jQuery UI ?
- Advantages and Disadvantages of various CPU scheduling algorithms
- How to Cast a JSON Object Inside of TypeScript Class ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.