11

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.

Community
  • 1
  • 1
Christian
  • 27,509
  • 17
  • 111
  • 155
  • 1
    @Christian I suggest opening up a chatroom for this - it's more suitable for this. A chatroom can be automatically created for this question using this link: http://chat.stackoverflow.com/questions/3948866/what-does-your-uname-say – Yi Jiang Oct 16 '10 at 12:34
  • Aren't chatrooms temporary? I'd like this to stay current so people may use results as they wish. – Christian Oct 16 '10 at 12:35
  • Why don't you use php_uname('s')? – Bill Lynch Oct 16 '10 at 12:36
  • 4
    @YiJiang why? This is potentially useful information for future generations as well – Pekka Oct 16 '10 at 12:37
  • @sharth `s` is a subset of the full info string and may vary e.g. across different Windowses. Finding out what it contains is the point of this exercise – Pekka Oct 16 '10 at 12:39
  • 1
    @Pekka On second thought, you're right, this would be more permanent. – Yi Jiang Oct 16 '10 at 12:39
  • 1
    sharth - That still produces mixed results. – Christian Oct 16 '10 at 12:39
  • @imgx64 - http://meta.stackexchange.com/questions/392/should-the-community-wiki-police-be-shut-down – Christian Oct 16 '10 at 12:45
  • 1
    Seems this *may* be useful, but a CW edited **answer** would probably be the best place to put the results. – Tim Lytle Oct 16 '10 at 12:46
  • 1
    http://stackoverflow.com/questions/738823/possible-values-for-php-os – mellowsoon Oct 16 '10 at 12:49
  • Tim, since I can't see that coming soon, we could keep getting answers here, migrate to the wiki at some point, and then close/delete this question. – Christian Oct 16 '10 at 12:49
  • 1
    As far as I can tell from a bit of googling, this list (both for PHP_OS and php_uname) has been compiled on stackoverflow a half a dozen times already. – mellowsoon Oct 16 '10 at 12:50
  • Number one and number three are exactly the same. – Octavian Helm Oct 16 '10 at 12:51
  • @mellowsoon can you post some links? I wasn't able to find any through the search – Pekka Oct 16 '10 at 12:51
  • @Christian - Feel free to edit mine, I've combined a few of the other answers to start the list: http://stackoverflow.com/questions/3948866/what-does-your-uname-say/3948945#3948945 – Tim Lytle Oct 16 '10 at 12:52
  • 1
    If 2 more people edit this question it will become CW automatically or you can flag for a mod to make it CW. – Martin Smith Oct 16 '10 at 12:55
  • 2
    This is a bit like looking at browser user agent strings. There's all of 5-6 popular browsers on the market, but 10k different user agent strings. – mellowsoon Oct 16 '10 at 12:56

16 Answers16

6

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
Devyn Collier Johnson
  • 4,124
  • 3
  • 18
  • 39
Tim Lytle
  • 17,549
  • 10
  • 60
  • 91
1

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
Steveorevo
  • 188
  • 1
  • 4
  • The “OS” section (`CYGWIN_NT-10.0-WOW`) has a different format from Windows. It could have been `Cygwin NT 10.0 WoW` which is much more readable. – Franklin Yu Jun 13 '20 at 07:24
1

Windows 7 Professional 64-bit, PHP 5.3 32-Bit:

Windows NT *Name of my machine* 6.1 build 7600 ((null)) i586
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • Why do it says "Windows NT" when you are running Windows 7? Same for me for Windows 10. – Omar Tariq Sep 24 '15 at 09:02
  • 1
    @OmarTariq historical reasons - Windows NT was a parallel development to Windows 3.x and 95, which were based on DOS, while NT was a completely new OS for servers, much more stable. The NT core eventually became the basis for all editions of Windows (I think from Windows XP onwards) – Pekka Sep 24 '15 at 09:27
1

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
Māris Kiseļovs
  • 16,957
  • 5
  • 41
  • 48
1

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
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
Eiko
  • 25,601
  • 15
  • 56
  • 71
1

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
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
1

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 i386
Where XXXX-YYYY is my name and surname

Windows XP SP3

Windows NT XXXXXX 5.1 build 2600
where XXXXX is machine name
cichy
  • 10,464
  • 4
  • 26
  • 36
1

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
greg0ire
  • 22,714
  • 16
  • 72
  • 101
1

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

Devyn Collier Johnson
  • 4,124
  • 3
  • 18
  • 39
Alexander Sagen
  • 4,028
  • 1
  • 18
  • 15
1

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

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288
1

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
Octavian Helm
  • 39,405
  • 19
  • 98
  • 102
1

Ubuntu 10.10 64bit, PHP 5.3.3:

Linux *name of machine* 2.6.35-22-generic #33-Ubuntu SMP SYSTEM_TIME x86_64

Devyn Collier Johnson
  • 4,124
  • 3
  • 18
  • 39
slosd
  • 3,224
  • 2
  • 21
  • 17
1

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
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
1

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
Gordon
  • 312,688
  • 75
  • 539
  • 559
0

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
boerl
  • 11
  • 1
0

Just to add a little bits to puzzle ..

Windows NT is kernel/platform branch name, yes, it is confusing a bit to see "NT 6.2" tag referring to Windows 8 Pro .
Windows version tags are quite well documented over here: https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions

For a curiosity, this is my Debian Stretch running as WLS (Windows Linux Subsystem) inside Windows 10 Pro x64 (system info on those Win10 states "Version 10.0.19042")

Linux SILVERSTONE 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux