Possible Values For: PHP_OS

Wilco picture Wilco · Apr 10, 2009 · Viewed 29.1k times · Source

Is there a place to find a list of the possible values for the PHP predefined constant PHP_OS ? I'd like to use this value for a system requirements check, but need to know how different operating systems are named in this variable.

Through some searching, so far I've compiled the following list:

  • CYGWIN_NT-5.1
  • Darwin
  • FreeBSD
  • HP-UX
  • IRIX64
  • Linux
  • NetBSD
  • OpenBSD
  • SunOS
  • Unix
  • WIN32
  • WINNT
  • Windows

If anyone has a more complete list, or knows of any additional values I'd love to hear them!

Answer

phihag picture phihag · Apr 10, 2009

PHP passes through the uname, except on Windows (WINNT) and Netware (Netware). See Wikipedia for a non-exhaustive list of values not mentioned in your question:

  • CYGWIN_NT-5.1
  • IRIX64
  • SunOS
  • HP-UX
  • OpenBSD (not in Wikipedia)