Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: PHP get apache version |
|
Author |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 30 Jan '08 15:55 Post subject: PHP get apache version |
|
|
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 |
|
|
|
|
|
|