Jump to content

PHP script to get OS name


sunilvadranapu

Recommended Posts

HI,

  I'm trying to develop a PHP script that should return OS name(Linux/UNIX)  of the system on which the script is running.

 

<?php
echo "php_uname: ". php_uname("s") ."\n";
  echo "PHP_OS: ". PHP_OS ."\n";
?>

 

This script is returning host name correctly but not OS name

 

php_uname: sun102

PHP_OS: sun56    --- it shoud be UNIX

 

Can anyone help me to get this.  Thanks in advance

 

-sun

Link to comment
https://forums.phpfreaks.com/topic/167254-php-script-to-get-os-name/
Share on other sites

the documentation point out that if your are running and old version of UNIX then it may fall back to the operating system on which PHP was built on. I believe this could be your problem.

 

You can read more here.

 

http://us2.php.net/manual/en/function.php-uname.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.