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 | 16 Comments »

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

  1. cold fire carts Says:
    September 6th, 2023 at 05:47

    … [Trackback]

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

  2. more info Says:
    October 5th, 2023 at 11:54

    … [Trackback]

    […] There you can find 21472 more Information to that Topic: compdigitec.com/labs/2008/07/16/determine-the-os-and-version-of-php/ […]

  3. แทงบอลออนไลน์ Says:
    October 5th, 2023 at 19:54

    … [Trackback]

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

  4. คาสิโนกาแลคซี่ จับมือพันธมิตร ผลิตเกมชั้นนำ มากมาย Says:
    November 2nd, 2023 at 19:47

    … [Trackback]

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

  5. Hunter898 แจกเครดิตฟรี Says:
    November 3rd, 2023 at 21:29

    … [Trackback]

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

  6. how to test lsd gel tabs Says:
    November 10th, 2023 at 00:29

    … [Trackback]

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

  7. batmanapollo.ru Says:
    November 26th, 2023 at 05:39

    batmanapollo.ru

    batmanapollo.ru

  8. 777 Says:
    November 27th, 2023 at 19:35

    777

    778

  9. wlw.su Says:
    November 28th, 2023 at 18:18

    wlw.su

    wlw.su

  10. vxi.su Says:
    November 28th, 2023 at 18:37

    vxi.su

    vxi.su

  11. nlpvip.ru Says:
    November 30th, 2023 at 11:48

    nlpvip.ru

    nlpvip.ru

  12. russianmanagement.com Says:
    November 30th, 2023 at 16:41

    russianmanagement.com

    russianmanagement.com

  13. Slovo pacana 6 seriya Says:
    December 1st, 2023 at 04:09

    Slovo pacana 6 seriya

    Slovo pacana 6 seriya

  14. site Says:
    December 2nd, 2023 at 13:36

    site

    site

  15. slovo-pacana-6-seriya Says:
    December 3rd, 2023 at 03:50

    slovo-pacana-6-seriya

    slovo-pacana-6-seriya

  16. manipulyation Says:
    December 3rd, 2023 at 19:40

    manipulyation

    manipulyation

Comments