[SOLVED] Determine server OS

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
allelopath
Forum Commoner
Posts: 34
Joined: Tue Mar 16, 2004 5:21 am

Determine server OS

Post by allelopath »

How can I determine the OS of the server?
I see examples of how to determine the client OS, but not the server.
phpInfo() does not seem to have this informaiton.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

phpinfo does have it.. the constant PHP_OS has the OS PHP is running on..
allelopath
Forum Commoner
Posts: 34
Joined: Tue Mar 16, 2004 5:21 am

Post by allelopath »

I think PHP_OS is what i need, though i don't need phpInfo to access it.
It seems to be a constants that can be accessed directly, e.g.

// see if OS is windows
if ( strtoupper(substr(PHP_OS, 3)) == 'WIN')
allelopath
Forum Commoner
Posts: 34
Joined: Tue Mar 16, 2004 5:21 am

Post by allelopath »

thanks
Post Reply