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

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

  1. pg168 Says:
    March 26th, 2025 at 08:15

    … [Trackback]

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

  2. 12 ค่าย บาคาร่า All Says:
    March 29th, 2025 at 13:39

    … [Trackback]

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

  3. ram for gaming Says:
    March 30th, 2025 at 12:43

    … [Trackback]

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

  4. grandpashabet Says:
    April 3rd, 2025 at 12:39

    Determine the OS and version of PHP at Compdigitec Labs

    https://30framesmultimedios.com/habilita-sspm-de-sjr-unidad-movil-para-pago-de-multas-durante-semana-santa/

  5. pg slot auto Says:
    April 26th, 2025 at 01:26

    … [Trackback]

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

  6. Forum Says:
    April 27th, 2025 at 21:30

    Forum

    Forum

  7. lsm99 auto Says:
    May 1st, 2025 at 18:43

    … [Trackback]

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

  8. t.me/s/psy_chat_online Says:
    May 7th, 2025 at 05:28

    t.me/s/psy_chat_online

    t.me/s/psy_chat_online

  9. Sochi-psiholog-Russia Says:
    May 10th, 2025 at 04:05

    Sochi-psiholog-Russia

    Sochi-psiholog-Russia

  10. Slotxo24hr พันธมิตรค่ายระดับตำนาน Says:
    May 16th, 2025 at 03:20

    … [Trackback]

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

  11. instagram.com/korotkovlakanfreud Says:
    May 17th, 2025 at 13:21

    instagram.com/korotkovlakanfreud

    instagram.com/korotkovlakanfreud

  12. 5yucMCMAAAAJ Says:
    May 17th, 2025 at 23:37

    5yucMCMAAAAJ

    5yucMCMAAAAJ

  13. altogel Says:
    May 30th, 2025 at 07:14

    … [Trackback]

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

  14. atvip.ru Says:
    May 30th, 2025 at 07:28

    atvip.ru

    atvip.ru

  15. 0410.ru Says:
    May 30th, 2025 at 08:52

    0410.ru

    0410.ru

  16. myprin92.ru Says:
    May 31st, 2025 at 03:51

    myprin92.ru

    myprin92.ru

  17. ekzistenczialnyj Says:
    June 4th, 2025 at 04:40

    ekzistenczialnyj

    ekzistenczialnyj

  18. jav Says:
    June 8th, 2025 at 14:48

    … [Trackback]

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

Comments