php_uname() : information about the operating system PHP is running on

Read operating-system information with php_uname()

php_uname() returns information about the operating system that is running PHP. PHP_OS_FAMILY and PHP_OS are often enough when code only needs to identify the platform family.

<?php
echo php_uname('s') . PHP_EOL;
echo PHP_OS_FAMILY;
?>
We can get information about the operating system , host name, release name, version information and machine type by using php_uname() function. Here is the simple command
<?Php
<br>echo php_uname();
<br>
?>
The output is here
Windows NT Alex 6.2 build 9200 (Unknow Windows version Business Edition) i586
Getting & setting PHP values of php.ini and getting server, operating system & PHP details to Manage


It can also take parameters to give specific information
'a' about all information below given
's' Operating system
'n' Host name
'r' release name
'v' version name
'm' machine type
Here is a sample cod to execute to know about the PHP environment.
<?Php
echo php_uname();
echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
echo php_uname('a');
echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
echo php_uname('s');
echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
echo php_uname('n');
echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
echo php_uname('r');
echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
echo php_uname('v');
echo &quot;&lt;br&gt;&lt;br&gt;&quot;;
echo php_uname('m');
?>
The sample output in a windows machine is here.
Windows NT Alex 6.2 build 9200 (Unknow Windows version Business Edition) i586
Windows NT Alex 6.2 build 9200 (Unknow Windows version Business Edition) i586
Windows NT
Alex
6.2
build 9200 (Unknow Windows version Business Edition)
i586

PHP_OS

This constant also returns about the Operating System. Here output is the operating system PHP was built on.
echo PHP_OS;
Output ( may change based on your system )
WINNT
PHP Version Collect php.ini settings by using ini_get() Introduction to PHP phpinfo() All about PHP configuration Guide to installation and How to write our first PHP Script



Subscribe to our YouTube Channel here



plus2net.com







Joh

24-06-2016

Great article.
What was the OS running that php?




PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer