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

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

  1. bit.ly/kto-takoy-opsuimolog Says:
    June 24th, 2024 at 07:44

    bit.ly/kto-takoy-opsuimolog

    bit.ly/kto-takoy-opsuimolog

  2. ทัวร์เกาะหลีเป๊ะ Says:
    July 14th, 2024 at 23:04

    … [Trackback]

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

  3. shorts Says:
    July 20th, 2024 at 14:52

    shorts

    shorts

  4. โคมไฟ Says:
    July 27th, 2024 at 19:52

    … [Trackback]

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

  5. ส่งพัสดุ Says:
    August 9th, 2024 at 23:06

    … [Trackback]

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

  6. senegal gambia Says:
    August 13th, 2024 at 10:57

    … [Trackback]

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

  7. yaltalife.ru Says:
    August 30th, 2024 at 16:08

    yaltalife.ru

    yaltalife.ru

  8. kinogo Says:
    September 4th, 2024 at 11:03

    kinogo

    kinogo

  9. รับทำเว็บไซต์ Says:
    September 5th, 2024 at 21:40

    … [Trackback]

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

  10. rasschitat dizayn cheloveka onlayn Says:
    September 9th, 2024 at 15:00

    rasschitat dizayn cheloveka onlayn

    rasschitat dizayn cheloveka onlayn

  11. raschet karty dizayn cheloveka Says:
    September 10th, 2024 at 00:03

    raschet karty dizayn cheloveka

    raschet karty dizayn cheloveka

  12. humandesignplanet.ru Says:
    September 10th, 2024 at 13:25

    humandesignplanet.ru

    humandesignplanet.ru

  13. human design Says:
    September 10th, 2024 at 14:39

    human design

    human design

  14. Event venue phuket Says:
    September 16th, 2024 at 20:41

    … [Trackback]

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

  15. Ulthera Says:
    September 17th, 2024 at 00:20

    … [Trackback]

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

  16. Opsumiologist Says:
    September 17th, 2024 at 11:34

    Opsumiologist

    Opsumiologist

  17. Psychologist #1 in the World Says:
    September 17th, 2024 at 12:13

    Psychologist #1 in the World

    Psychologist #1 in the World

  18. Best Psychologist in the World Says:
    September 17th, 2024 at 13:34

    Best Psychologist in the World

    Best Psychologist in the World

  19. บ้านพักพูลวิลล่า หัวหิน Says:
    September 22nd, 2024 at 09:40

    … [Trackback]

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

  20. dayz hacks free Says:
    October 5th, 2024 at 19:45

    … [Trackback]

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

  21. printsipy forda Says:
    October 15th, 2024 at 10:41

    printsipy forda

    printsipy forda

  22. เรียนต่อจีน Says:
    October 17th, 2024 at 16:24

    … [Trackback]

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

  23. dizain-cheloveka Says:
    October 19th, 2024 at 09:30

    dizain-cheloveka

    dizain-cheloveka

  24. จอ led ขนาดใหญ่ Says:
    October 20th, 2024 at 21:03

    … [Trackback]

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

  25. สล็อตฝากถอน true wallet Says:
    October 21st, 2024 at 20:10

    … [Trackback]

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

Comments