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
- jQuery UI | Tooltip
- CSS | fit-content() Property
- jQuery UI | Tabs
- How to change the placeholder text using jQuery?
- How to perform wordpress security auditing?
- Angular 4 | Introduction
- PHP | ReflectionClass isIterateable() Function
- Laravel | Route::resource vs Route::controller
- PHP | Imagick roundCorners() Function
- PHP | ReflectionClass isUserDefined() Function
- PHP | ReflectionClass isTrait() Function
- PHP | ReflectionClass isSubclassOf() Function
- PHP | Imagick resizeImage() Function
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.