Find if the installed PHP is threadsafe or nonthreadsafe?

04/21/2020 10:00:01

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.

Verified Answer (164 Votes)

04/27/2011 11:37:17

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:

  • On Windows : php -i|findstr "Thread"
  • On *nix: php -i|grep Thread

Answer #2 (22 Votes)

03/05/2012 19:37:29

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


Thread Safety => disabled

Answer #3 (4 Votes)

04/27/2011 12:31:43

Create a new PHP file and insert this code in it:

phpinfo(); ?>

Then run this page and you will find all of the PHP information. Search for the term that you want, and it will show you it's enabled.

Hack Hex uses Stack Exchance API by the Stack Exchange Inc. to scrape questions/answers under Creative Commons license.