Page 1 of 1

Determine Apache version via user program

PostPosted: 13. June 2014 01:42
by AndyS01
I need to obtain and also display the currently running Apache version. I'm using AutoIT scripting language (much like perl/javascript). I can read a file and extract the data from it, but I cannot see a file with this information. When I view the running services, I can see that there is an Apache2.4 service with a description telling me that it's version 2.4.3. That's the version I need.

Re: Determine Apache version via user program

PostPosted: 13. June 2014 06:06
by Altrea
How is that question related to XAMPP?

Re: Determine Apache version via user program

PostPosted: 14. June 2014 21:10
by luco_el_loco
To the OP: have you checked http://localhost/xampp/ and selected the phpinfo() page/link for the information or are you trying to display the Apache version in your own webpage?

Re: Determine Apache version via user program

PostPosted: 16. June 2014 01:50
by AndyS01
I have a configuration program (written in AutoIT) that configures xampp-installed files after a clean install. The apache-related files I need to modify are different from the 1.8.1 installation than those of a 1.8.3 installation. If I can obtain the Apache version, I can either modify my configuration steps based on a known version or I could display an error popup if I haven't written configuration steps for that version.

Re: Determine Apache version via user program

PostPosted: 16. June 2014 06:37
by Altrea
The only really safe way to determine the correct Apache version is by requesting the server information by command line
Code: Select all
C:\xampp\apache\bin>httpd -V | find "Server version"

Re: Determine Apache version via user program

PostPosted: 16. June 2014 10:16
by Nobbie
Altrea wrote:The only really safe way to determine the correct Apache version is by requesting the server information by command line
Code: Select all
C:\xampp\apache\bin>httpd -V | find "Server version"


Thats not quite right, you may also run phpfinfo() and parse the output for "Apache Version". In the contribution notes of phpinfo() are some very usefull code examples how to catch and to store/analyze the output of phpinfo():

http://php.net//manual/en/function.phpinfo.php

Re: Determine Apache version via user program

PostPosted: 17. June 2014 05:35
by Altrea
My information is still correct, because the information in phpinfo() is dependend on the Apache configuration "ServerTokens", which the command line information is not.

Re: Determine Apache version via user program

PostPosted: 19. June 2014 20:40
by gsmith
There's also c:\xampp\apache\include\ap_release.h which can be parsed to grab the version.

Looking at AutoIT you can "Directly call external DLL and Windows API functions" so you could get the version out of libhttpd.dll. Grab the source at httpd.apache.org and look in source_root\server\core.c for the possibilities.

Re: Determine Apache version via user program

PostPosted: 20. July 2014 16:25
by AndyS01
Thanks, that's what I needed.

I used "_ap_get_server_revision@4" in "C:\xampp\apache\bin\libhttpd.dll". It returns:
int major; /**< major number */
int minor; /**< minor number */
int patch; /**< patch number */
const char *add_string; /**< additional string like "-dev" */