homepage Welcome to WebmasterWorld Guest from 54.234.0.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Detect the server's OS
Jakotsu




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

Hi,
Is there some function to guess if the server is running under Linux or Windows? Thanks!

 

d40sithui




msg:3415994
 5:22 pm on Aug 7, 2007 (gmt 0)

try this
echo $_SERVER['SERVER_SOFTWARE'];

whoisgregg




msg:3416789
 1:44 pm on Aug 8, 2007 (gmt 0)

Anytime you need to know something about the server that is running PHP, check out the predefined variables manual page [php.net]. :)

coopster




msg:3417899
 1:53 pm on Aug 9, 2007 (gmt 0)

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
}

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved