18 August 2013

PHP Get Server OS Name

The operating system name where the php running on can be read by several ways;
echo PHP_OS;

// output: CentOS

But if we want to get more detailed information about the OS, we may use php_uname
echo php_uname('s');

// output: Linux 2.6.18-348.6.1.el5 x86_64

php_uname gives information including; OS name, OS version, if it is 32bit or 64bit.

No comments: