« 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 | 20 Comments »

October 25th, 2026 at 03:26
100 tsitat velikikh lyudey
100 tsitat velikikh lyudey
October 25th, 2026 at 04:55
Psychoanalyst
Psychoanalyst
October 25th, 2026 at 07:29
Freid
Freid
October 28th, 2026 at 15:31
yalta
yalta
October 29th, 2026 at 03:19
… [Trackback]
[…] Find More here to that Topic: compdigitec.com/labs/2008/07/16/determine-the-os-and-version-of-php/ […]
October 30th, 2026 at 03:02
psychologist
psychologist
October 30th, 2026 at 14:25
management
management
October 30th, 2026 at 15:39
structure-of-legal-norms
structure-of-legal-norms
October 30th, 2026 at 16:12
Carl Gustav Jung
Carl Gustav Jung
October 31st, 2026 at 13:03
archive
archive
November 2nd, 2026 at 14:25
Q141974782
Q141974782
November 4th, 2026 at 17:32
psiholog-psiholog-onlajn
psiholog-psiholog-onlajn
November 5th, 2026 at 03:56
Single-Session
Single-Session
November 6th, 2026 at 14:23
Online psychologist
Online psychologist
November 10th, 2026 at 07:54
Cognitive warfare
Cognitive warfare
November 11th, 2026 at 04:14
Cognitive
Cognitive
November 16th, 2026 at 05:13
scholar
scholar
November 16th, 2026 at 16:04
orcid
November 16th, 2026 at 16:44
post
post
November 17th, 2026 at 02:16
doi
doi