note 124206 added to function.php-uname

From: Date: Wed, 18 Sep 2019 17:24:44 +0000
Subject: note 124206 added to function.php-uname
Groups: php.notes 
Request: Send a blank email to php-notes+get-212245@lists.php.net to get a copy of this message
Although it does not indicate receiving parameters this function allows some chars as parameters, they are the options a; m; n; r; s; v. I don't know exactly what each one does, but below is a code example and its output on PHP 5.5 running on RedHat 4.4 <?php echo '<pre>'; echo '(void): '.php_uname()."\n"; // output: "(void): Linux web989.uni5.net 4.4.180 #1 SMP Wed May 22 15:27:37 -03 2019 x86_64" echo 'a: '.php_uname('a')."\n"; // output: "a: Linux web989.uni5.net 4.4.180 #1 SMP Wed May 22 15:27:37 -03 2019 x86_64" echo 'm: '.php_uname('m')."\n"; // output: "m: x86_64" echo 'n: '.php_uname('n')."\n"; // output: "n: web989.uni5.net" echo 'r: '.php_uname('r')."\n"; // output: "r: 4.4.180" echo 's: '.php_uname('s')."\n"; // output: "s: Linux" echo 'v: '.php_uname('v')."\n"; // output: "v: #1 SMP Wed May 22 15:27:37 -03 2019" // echo file_get_contents('/etc/issue')."\n"; echo '</pre>'; phpinfo(); ?> Note that I used file_get_contentes with a file, that file is present in most linux boxies and varies on content, but most of times it indicates kernel version, linux version, distribution and so on. In my case my user didn't have access to the file, so to identify that it was a red hat I paid attention to php_info outputs, there in the middle was the postgress driver description, p. eg indicating the distribution. I guess there is no easy way to find out the server version programmatically a 100% of times, but by and large you can get around by yourself. ---- Server IP: 208.43.231.9 Probable Submitter: 82.199.157.54 (proxied: 2804:14c:8786:8bce:dc7a:8f5f:ab5a:c2f3) ---- Manual Page -- http://php.net/manual/en/function.php-uname.php Edit -- https://master.php.net/note/edit/124206 Del: integrated -- https://master.php.net/note/delete/124206/integrated Del: useless -- https://master.php.net/note/delete/124206/useless Del: bad code -- https://master.php.net/note/delete/124206/bad+code Del: spam -- https://master.php.net/note/delete/124206/spam Del: non-english -- https://master.php.net/note/delete/124206/non-english Del: in docs -- https://master.php.net/note/delete/124206/in+docs Del: other reasons-- https://master.php.net/note/delete/124206 Reject -- https://master.php.net/note/reject/124206 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#212245) next »