Re: How to detect if PHP was built with thread safety (ZTS)?
| From: | Aziz Saleh | Date: | Mon, 04 Apr 2016 00:57:24 +0000 |
| Subject: | Re: How to detect if PHP was built with thread safety (ZTS)? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-325529@lists.php.net to get a copy of this message | ||
On Sun, Apr 3, 2016 at 8:27 PM, lj <lj308@pobox.com> wrote:
> Is there any way a PHP script can tell if the PHP it is running under was
> built with thread safety (ZTS)? I have some test code that would like to
> know. I don't see any constant, function, etc. that can be used to directly
> check if ZTS is enabled. The only way I've found is ob_start,
> phpinfo(INFO_GENERAL), then check the buffer for "Thread Safety" followed
> by Enabled or Disabled. Kind of ugly, and fragile. Is there a better way?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Try:
$ops = get_defined_constants();
var_dump($ops['PHP_ZTS']);