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

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

  1. funkymedia Says:
    March 15th, 2022 at 08:28

    … [Trackback]

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

  2. slot999 Says:
    March 16th, 2022 at 08:06

    … [Trackback]

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

  3. บอลโลกโซนยุโรป Says:
    May 26th, 2022 at 18:59

    … [Trackback]

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

  4. Sobha Manhattan Towers Says:
    June 11th, 2022 at 13:02

    … [Trackback]

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

  5. pg slot Says:
    June 19th, 2022 at 02:59

    กิน kfc ยังไงให้รวยเล่น Pg สั่งไก่ทอด kfc มาทานระหว่างเล่น Pg เกมสล็อตออนไลน์ไปด้วย ช่วยให้อิ่มท้อง เป็นอีกหนึ่งหนทางที่ ให้กับลูกค้าเคเอฟซีที่เอาใจใส่สุขภาพอีกด้วย

  6. nova88 Says:
    July 4th, 2022 at 14:53

    … [Trackback]

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

  7. WordPress Hosting Says:
    July 21st, 2022 at 07:13

    … [Trackback]

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

  8. nova88 Says:
    August 13th, 2022 at 18:11

    … [Trackback]

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

  9. crédit personnel belgique Says:
    August 19th, 2022 at 21:25

    … [Trackback]

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

  10. remington guns Says:
    September 9th, 2022 at 10:59

    … [Trackback]

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

  11. discover here Says:
    September 24th, 2022 at 03:51

    … [Trackback]

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

  12. สินเชื่อโฉนดที่ดิน เพื่อนแท้ Says:
    October 6th, 2022 at 10:24

    … [Trackback]

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

  13. truck driving school Says:
    October 16th, 2022 at 18:18

    … [Trackback]

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

  14. ยืม เงินด่วนออนไลน์ โอนเข้าบัญชี ได้จริง Says:
    October 30th, 2022 at 13:32

    … [Trackback]

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

  15. Cupra Formentor Forum Says:
    October 31st, 2022 at 06:07

    … [Trackback]

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

  16. cabo san lucas real estate Says:
    November 9th, 2022 at 13:58

    … [Trackback]

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

  17. Darknet Says:
    November 11th, 2022 at 16:08

    … [Trackback]

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

  18. visiter le site Web Says:
    December 27th, 2022 at 07:00

    … [Trackback]

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

  19. jack daniels coy hill 2021 where to buy Says:
    January 7th, 2023 at 13:13

    … [Trackback]

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

  20. mp3juices Says:
    January 23rd, 2023 at 22:57

    … [Trackback]

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

  21. passive income investments Says:
    January 28th, 2023 at 09:24

    … [Trackback]

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

  22. รับขัดพื้นกระเบื้อง Says:
    January 30th, 2023 at 18:38

    … [Trackback]

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

Comments