9

I use PHP_OS constant and I want to know what it can return on differents OS.

I found this :

  • On Linux -> Linux
  • On FreeDSB -> FreeBSD
  • On Windows NT -> WINNT
  • On Mac Os X -> Darwin

Can anyone tell me what they get with them configurations ? On Solaris, Windows XP...

2
  • So you want to know what information can be read out of the information returned by phpinfo?
    – Gumbo
    Commented May 16, 2009 at 17:16
  • This is a terrible place to collect info like this. And you're talking about OS fingerprinting. Go try nmap.
    – guns
    Commented May 16, 2009 at 17:17

3 Answers 3

5

Just for the record... I'm running on Windows XP and this is what's returned:

PHP_OS : WINNT

php_uname('s') : Windows NT

UPDATE: The same on Windows 7.

3

Try php_uname for retrieving operating system information

0
-1

Edit: This answer refers to an older version of this question, and may no longer be relevant.

The variants are so numerous as to be relatively useless for most sane applications; the "system" information is derived from a number of pieces of information about the environment, usually at compile time.

If you're looking to inspect the specific capabilities of the PHP configuration, you're better off querying specifics; checking configuration flags or for the existence of functions from extensions, etc.

Note: You mention HTTP_USER_AGENT. User-agent isn't the same as system; a user agent is the software running on the client that's issuing requests to the server - usually a web browser. User agent sniffing is an often invaluable tool for dealing with cross-browser compatibility issues.

1
  • For HTTP_USER_AGENT, I'm ok with you, it's cause I say "without use $_SERVER["HTTP_USER_AGENT"]" Commented May 16, 2009 at 18:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.