On Thu, Dec 6, 2018 at 9:25 AM Andrew Green <and...@article7.co.uk> wrote:
> Hi all, > > Huge thanks to everyone for your replies on this. I’ve now been able to > work through everything, and I thought I’d post a quick update with some > additional notes in case there’s anyone else in the same boat searching the > archives in the future! > > 1. I was able to use the following as a way of determining which version > of Apache is in use at runtime: > > my $server_version = Apache2::ServerUtil::get_server_banner(); > my $is_old_apache = ($server_version =~ /Apache\/2\.2/) ? 1 : 0; > Just a little warning, the server_banner is controlled by the admin, and may not include the entire Apache/2.2 token. The server_description fleshed this out beyond the control of the admin, but isn't meant for transmission; /** * Get the server banner in a form suitable for sending over the * network, with the level of information controlled by the * ServerTokens directive. * @return The server banner */ AP_DECLARE(const char *) ap_get_server_banner(void); /** * Get the server description in a form suitable for local displays, * status reports, or logging. This includes the detailed server * version and information about some modules. It is not affected * by the ServerTokens directive. * @return The server description */ AP_DECLARE(const char *) ap_get_server_description(void); But you are better off looking at; http://perl.apache.org/docs/2.0/api/Apache2/ServerUtil.html#C_get_server_version_ which returns nothing except exactly what you are asking.