« OCR for PDF in Ubuntu | Home | Measure CPU temperature and your fan speed in Ubuntu Linux »
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 »
June 24th, 2024 at 07:44
bit.ly/kto-takoy-opsuimolog
bit.ly/kto-takoy-opsuimolog
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/ […]
July 20th, 2024 at 14:52
shorts
shorts
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/ […]
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/ […]
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/ […]
August 30th, 2024 at 16:08
yaltalife.ru
yaltalife.ru
September 4th, 2024 at 11:03
kinogo
kinogo
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/ […]
September 9th, 2024 at 15:00
rasschitat dizayn cheloveka onlayn
rasschitat dizayn cheloveka onlayn
September 10th, 2024 at 00:03
raschet karty dizayn cheloveka
raschet karty dizayn cheloveka
September 10th, 2024 at 13:25
humandesignplanet.ru
humandesignplanet.ru
September 10th, 2024 at 14:39
human design
human design
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/ […]
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/ […]
September 17th, 2024 at 11:34
Opsumiologist
Opsumiologist
September 17th, 2024 at 12:13
Psychologist #1 in the World
Psychologist #1 in the World
September 17th, 2024 at 13:34
Best Psychologist in the World
Best Psychologist in the World
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/ […]
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/ […]
October 15th, 2024 at 10:41
printsipy forda
printsipy forda
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/ […]
October 19th, 2024 at 09:30
dizain-cheloveka
dizain-cheloveka
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/ […]
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/ […]