How can I check in a PHP script if it's running in a windows or unix environment?
A:
Here's what I'm using:
if(PHP_SHLIB_SUFFIX == 'so')// *nix (aka NOT windows)
{
// Blah
}
else // Windows
{
// Blah again
}
It's simple and you don't need to wade through the massive number of options of things like PHP_OS
Blair McMillan
2009-12-31 23:01:51
A:
I believe this information is available in the $_SERVER
variable as follows:
$_SERVER['SERVER_SOFTWARE']
Kaleb Brasee
2009-12-31 23:03:18
A:
PHP_OS as mentioned above for a simple variable.
See also: php_uname() For a longer answer.
jjclarkson
2009-12-31 23:04:43