note 49099 added to function.apache-get-version
| From: | Pedro at osu1 dot php dot net | Date: | Sun, 16 Jan 2005 20:13:58 +0000 |
| Subject: | note 49099 added to function.apache-get-version | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83459@lists.php.net to get a copy of this message | ||
I just wanted to get the Apache version number I was running but apache_get_version returned a
string like this:
Apache/1.3.33 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.10
FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7a
Not very user-friendly if you're trying to tell them what version they're running, so I
came up with this:
<?php
echo("Apache: <strong>" . preg_replace("/\) (.*)/i", ")",
ereg_replace("Apache/", "", apache_get_version())) .
"</strong>.");
?>
Which returns something like:
Apache: <strong>1.3.33 (Unix)</strong>.
It's probably not very efficient but I hope it helps someone.
----
Manual Page -- http://www.php.net/manual/en/function.apache-get-version.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49099
Delete -- http://master.php.net/manage/user-notes.php?action=delete+49099&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49099&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+49099&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+49099&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+49099&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+49099&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49099&report=yes
Search -- http://master.php.net/manage/user-notes.php