How do I find out whether the installed version of PHP is threadsafe or not thread safe?
Please note that I'm not asking the difference between a threadsafe/non thread safe installation. I would like to find out what is installed currently.
There is no rule that makes the code thread safe, the only thing you can do is make sure that your code will work no matter how many times is it being actively executed, each thread can be interrupted at any point, with each thread being in its own state/location, and this for each function (static or otherwise) that ...
The difference of NTS and TS is in the name itself. TS = Thread Safe. NTS = Non Thread Safe. Though the non checking of thread safty the NTS version is a very little faster.
Not thread safe: Data structures should not be accessed simultaneously by different threads.
Open a phpinfo() and search for the line Thread safety. For a thread-safe build you should find enable.
As specified in the comments by Muhammad Gelbana you can also use:
php -i|findstr "Thread"
php -i|grep Thread
If you prefer to use the command line:
*nix:
php -i | grep -i "Thread"
Windows:
php -i | findstr -i "thread"
This should give you something like this:
Thread Safety => enabled
or
Thread Safety => disabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With