Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: coopster & jatar k

Detect the server's OS

   
5:15 pm on Aug 7, 2007 (gmt 0)

10+ Year Member



Hi,
Is there some function to guess if the server is running under Linux or Windows? Thanks!
5:22 pm on Aug 7, 2007 (gmt 0)

5+ Year Member



try this
echo $_SERVER['SERVER_SOFTWARE'];
1:44 pm on Aug 8, 2007 (gmt 0)

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Anytime you need to know something about the server that is running PHP, check out the predefined variables manual page [php.net]. :)
1:53 pm on Aug 9, 2007 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



For server OS there is also the predefined constants [php.net]. I often use this for determining between Windows and all others:
if (stristr [php.net](PHP_OS, 'WIN')) { 
// Win
} else {
// Other
}
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month