Determine Apache version via user program

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Determine Apache version via user program

Postby AndyS01 » 13. June 2014 01:42

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.
AndyS01
 
Posts: 24
Joined: 24. March 2013 15:58
Operating System: Windows 7

Re: Determine Apache version via user program

Postby Altrea » 13. June 2014 06:06

How is that question related to XAMPP?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8299
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Determine Apache version via user program

Postby luco_el_loco » 14. June 2014 21:10

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?
User avatar
luco_el_loco
 
Posts: 5
Joined: 18. August 2013 12:40
Operating System: Windows 7

Re: Determine Apache version via user program

Postby AndyS01 » 16. June 2014 01:50

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.
AndyS01
 
Posts: 24
Joined: 24. March 2013 15:58
Operating System: Windows 7

Re: Determine Apache version via user program

Postby Altrea » 16. June 2014 06:37

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"
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8299
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Determine Apache version via user program

Postby Nobbie » 16. June 2014 10:16

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
Nobbie
 
Posts: 8780
Joined: 09. March 2008 13:04

Re: Determine Apache version via user program

Postby Altrea » 17. June 2014 05:35

My information is still correct, because the information in phpinfo() is dependend on the Apache configuration "ServerTokens", which the command line information is not.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8299
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Determine Apache version via user program

Postby gsmith » 19. June 2014 20:40

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.
gsmith
 
Posts: 196
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win XP to 2012R2/VS 6,9,11,14

Re: Determine Apache version via user program

Postby AndyS01 » 20. July 2014 16:25

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" */
AndyS01
 
Posts: 24
Joined: 24. March 2013 15:58
Operating System: Windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: DarthSidus and 57 guests