Short story: I need to write a PHP script which finds the correct OS type from uname (eg: both wince
and winnt
would return windows
). See here for more info.
Shouldn't this be a community wiki?
Yes but...see here.
How to help: If your OS is not listed below, please run this code and share your findings:
<?php
echo php_uname();
?>
Or, in a Unix shell, try
user@host ~ > php -a
php > echo php_uname();
List of shared results
- Darwin ... 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
- Darwin ... 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
- Windows NT ... 6.1 build 7600
- Linux ... 2.6.24-24-xen #1 SMP Tue Aug 18 18:15:39 UTC 2009 x86_64
- Linux ... 2.6.34.7-56.fc13.x86_64 #1 SMP Wed Sep 15 03:36:55 UTC 2010 x86_64
- Linux ... 2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:26:08 UTC 2010 i686
- Windows NT ... 5.1 build 2600
- Windows NT ... 6.0 build 6002 (Windows Server 2008 Standard Edition Service Pack 2) i586
- Windows NT ... 6.1 build 7600 ((null)) i586
It's interesting to note that even when certain conditions match exactly, uname still produces different results.
Seems like this is the browscap for uname. Feel free to edit/update this list:
- Ubuntu 10.10 32bit (i686)
Linux SYSTEM_NAME 2.6.35-22-generic #34-Ubuntu SMP SYSTEM_DATE i686
- Ubuntu 10.04 32bit, PHP 5.3.2
Linux SYSTEM_NAME 2.6.32-25-generic #44-Ubuntu SMP SySTEM_DATE i686
- Ubuntu 10.04 x64
Linux SYSTEM_NAME 2.6.32-25-generic #44-Ubuntu SMP SYSTEM_DATE x86_64t
- Ubuntu 13.04 x86_64
Linux SYSTEM_NAME 3.8.0-29-generic #42-Ubuntu SMP SYSTEM_DATE x86_64 GNU/Linux
- Debian GNU/Linux 4.0 (etch) 32bit, PHP 5.2.0
Linux SYSTEM_NAME 2.6.18-028stab062.3 #1 SMP SYSTEM_DATE i686
- Gentoo linux, 32bit, PHP 5.2:
Linux SYSTEM_NAME 2.6.35-gentoo-r8sh #1 SMP PREEMPT SYSTEM_DATE i686
- Fedora 13 64 bits:
Linux SYSTEM_NAME 2.6.34.7-56.fc13.x86_64 #1 SMP SYSTEM_DATE x86_64
- Centos 5.5 x86:
Linux SYSTEM_NAME 2.6.18-194.17.1.el5 #1 SMP SYSTEM_DATE i686
- Mac OS Snow Leopard (imac 24")
Darwin SYSTEM_NAME.local 10.4.0 Darwin Kernel Version 10.4.0: SYSTEM_DATE; root:xnu-1504.7.4~1/RELEASE_I386 i386
- Windows 7 Professional 64-bit, PHP 5.3 32-Bit:
Windows NT SYSTEM_NAME 6.1 build 7600 ((null)) i586
- Windows 2008 Server 64-Bit
Windows NT SYSTEM_NAME 6.0 build 6002 (Windows Server 2008 Standard Edition Service Pack 2) i586
- Windows XP SP3
Windows NT SYSTEM_NAME 5.1 build 2600
Windows 7 Professional 64-bit, PHP 5.3 32-Bit:
Windows NT *Name of my machine* 6.1 build 7600 ((null)) i586
Gentoo linux, 32bit, PHP 5.2:
Linux office 2.6.35-gentoo-r8sh #1 SMP PREEMPT Tue Sep 28 13:35:58 EEST 2010 i686
Mac OS Snow Leopard (imac 24")
Darwin XXXXXXX-YYYYYYY.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386Where XXXX-YYYY is my name and surname
Windows XP SP3
Windows NT XXXXXX 5.1 build 2600where XXXXX is machine name
Fedora 13 64 bits:
greg@liche :) ~ > php -a
Interactive shell
php > echo php_uname();
Linux liche.gregnet 2.6.34.7-56.fc13.x86_64 #1 SMP Wed Sep 15 03:36:55 UTC 2010 x86_64
Ubuntu 10.04, 64 bit, with PHP Version 5.3.2:
Linux MY_SYSTEM_NAME 2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:05:27 UTC 2010 x86_64
Mac OS X 10.6.4, php 5.3.2
Darwin [myMachineName] 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
Ubuntu 10.10 32bit (i686)
PHP version
PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010 14:17:04)
Output:
Linux lenovo-t60 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:24:00 UTC 2010 i686
Windows 2008 Server 64-Bit, PHP 5.2 32-Bit both through Apache and in CLI:
Windows NT *Name of machine* 6.0 build 6002 (Windows Server 2008 Standard Edition Service Pack 2) i586
Centos 5.5 x86:
Linux <hostname>.<domainname> 2.6.18-194.17.1.el5 #1 SMP Wed Sep 29 12:51:33 EDT 2010 i686
Windows 7 64bit with php-5.3.3-nts-Win32-VC9-x86
Windows NT <name> 6.1 build 7600 (Unknow Windows version Ultimate Edition) i586
Ubuntu 10.4 32bit, PHP 5.3.2
Linux SYSTEM_NAME 2.6.32-25-generic #44-Ubuntu SMP SYSTEM_TIME i686
Debian GNU/Linux 4.0 (etch) 32bit, PHP 5.2.0
Linux SYSTEM_NAME 2.6.18-028stab062.3 #1 SMP SYSTEM_TIME i686
Ubuntu 10.10 64bit, PHP 5.3.3:
Linux *name of machine* 2.6.35-22-generic #33-Ubuntu SMP SYSTEM_TIME x86_64
Cygwin(32-bit install) running on Windows 10 64-bit, running PHP 5.6.17
CYGWIN_NT-10.0-WOW win8-testing-vm 2.4.1(0.293/5/3) 2016-01-24 11:24 i686
macOS (a.k.a. Mac OS X) Sierra 10.12.2 on a MacBookPro11,1
Darwin myhostname 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
来源:https://stackoverflow.com/questions/3948866/what-does-your-uname-say