homepage Welcome to WebmasterWorld Guest from 54.242.241.20
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
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

5+ Year Member



 
Msg#: 3415989 posted 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

5+ Year Member



 
Msg#: 3415989 posted 5:22 pm on Aug 7, 2007 (gmt 0)

try this
echo $_SERVER['SERVER_SOFTWARE'];

whoisgregg

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



 
Msg#: 3415989 posted 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

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



 
Msg#: 3415989 posted 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