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 Draw a Pentagon using HTML and CSS?
- How to display a PDF as an image in React app using URL?
- Creating Responsive Grid Vanilla using HTML,CSS and Bootstrap
- HTML onplay Attribute
- HTML onloadeddata Attribute
- D3.js selection.empty() Function
- D3.js selection.on() Function
- HTML onprogress Attribute
- gpm Command in Linux with Examples
- Persisting Data in ElectronJS
- TypeScript Number valueOf() Method
- How to validate if input in input field has integer number only using express-validator ?
- Vue.js Mixins
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.