Reputation: 31
Is there an alternative way to get my Apache version without using the below code?
<?php echo $_SERVER['SERVER_SOFTWARE']; ?>
Returns "Apache".
<?php echo apache_get_version(); ?>
Returns "Fatal error: Call to undefined function apache_get_version()".
Note: I am using a Linux server with PHP v5.3.1, and anything returned with a linux-only command via the shell using exec() or shell_exec() would be acceptable. I just want to get it detecting the version of Apache for Linux at least.
Upvotes: 3
Views: 1255
Reputation: 18550
you say using exec is fine ?
exec("apache2 -v") will give the output similar to
Server version: Apache/2.2.16 (Debian)
Server built: Nov 30 2012 08:33:45
using your first command would be best and just makiing apache expose itself a little more
http://httpd.apache.org/docs/2.2/mod/core.html#ServerTokens
Change the .htaccess or the httpd.conf file to the token you want
Upvotes: 0