logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: PHP get apache version
Author
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 30 Jan '08 15:55    Post subject: PHP get apache version Reply with quote

Code:

<?php
function getApacheVersion($rootDir) {
   $binFile = "$rootDir\\Apache.exe";
   if (!file_exists($binFile)) {
      $binFile = "$rootDir\\bin\\Apache.exe";
      if (!file_exists($binFile)) {
         $binFile = "$rootDir\\bin\\httpd.exe";
         if (!file_exists($binFile)) {
            return "";
         }
      }
   }
   $fd = @popen("\"$binFile\" -V", "r");
   while (!feof($fd)) {
      if (preg_match("|^Server version: *(.*)$|mi", fgets($fd), $matches)) {
         pclose($fd);
         return $matches[1];
      }
   }
   pclose($fd);
   return "";
}

echo getApacheVersion("D:/server2/apache/");
?>
Back to top


Reply to topic   Topic: PHP get apache version View previous topic :: View next topic
Post new topic   Forum Index -> Other Software