{"id":4,"date":"2008-07-16T16:31:19","date_gmt":"2008-07-16T20:31:19","guid":{"rendered":"http:\/\/www.compdigitec.com\/labs\/?p=4"},"modified":"2008-07-16T16:31:19","modified_gmt":"2008-07-16T20:31:19","slug":"determine-the-os-and-version-of-php","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2008\/07\/16\/determine-the-os-and-version-of-php\/","title":{"rendered":"Determine the OS and version of PHP"},"content":{"rendered":"<p>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.<br \/>\n<em>This finds the version and OS the PHP on your server, not that person that is visiting your site.<\/em><\/p>\n<p>To get the version of PHP, use <code>phpversion()<\/code>, a hidden function in PHP. However, your OS maker may have customized this so it may not be a pure number. For example, on <a href=\"http:\/\/www.ubuntu.com\/\">Ubuntu Linux<\/a> it returns <code>5.2.4-2ubuntu5.1<\/code>, but on a Windows binary from <a href=\"http:\/\/php.net\">php.net<\/a> it returns <code>5.2.5<\/code>, which is a pure number.<\/p>\n<p>And to get the OS of PHP, use the hidden constant PHP_OS. If it doesn&#8217;t work, you could also try the following, even though the chances are very unlikely:<br \/>\n<code><br \/>\n$_ENV['OS']<br \/>\n$_SERVER['OS']<br \/>\n$_SERVER['SERVER_SOFTWARE'] \/\/ The OS Info may be in there<br \/>\n<\/code><\/p>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=4"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}