Compdigitec Labs

« | Home | »

Determine the OS and version of PHP

By admin | July 16, 2008

It is very hard to determine the OS of the server/computer that is running PHP. So therefore here are two very, very useful methods to get the OS and Version of PHP.
This finds the version and OS the PHP on your server, not that person that is visiting your site.

To get the version of PHP, use phpversion(), a hidden function in PHP. However, your OS maker may have customized this so it may not be a pure number. For example, on Ubuntu Linux it returns 5.2.4-2ubuntu5.1, but on a Windows binary from php.net it returns 5.2.5, which is a pure number.

And to get the OS of PHP, use the hidden constant PHP_OS. If it doesn’t work, you could also try the following, even though the chances are very unlikely:

$_ENV['OS']
$_SERVER['OS']
$_SERVER['SERVER_SOFTWARE'] // The OS Info may be in there

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: PHP | 7 Comments »

7 Responses to “Determine the OS and version of PHP”

  1. 10000 Says:
    November 8th, 2024 at 09:05

    10000

    10000

  2. 9gm.ru Says:
    November 8th, 2024 at 09:47

    9gm.ru

    9gm.ru

  3. hdorg2.ru Says:
    November 10th, 2024 at 01:58

    hdorg2.ru

    https://hdorg2.ru/

  4. raso.su Says:
    November 10th, 2024 at 09:41

    raso.su

    raso.su

  5. SLOTXO ทางเข้าเกม สมัครฟรี Says:
    November 17th, 2024 at 10:16

    … [Trackback]

    […] Here you will find 52102 more Info to that Topic: compdigitec.com/labs/2008/07/16/determine-the-os-and-version-of-php/ […]

  6. poker Says:
    November 27th, 2024 at 20:45

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2008/07/16/determine-the-os-and-version-of-php/ […]

  7. สล็อตเว็บตรง สมัครใหม่ เล่นเกมไหนโบนัสก็แตก Says:
    December 18th, 2024 at 21:47

    … [Trackback]

    […] Find More Info here on that Topic: compdigitec.com/labs/2008/07/16/determine-the-os-and-version-of-php/ […]

Comments