logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: How to create apache 2.4 modules on win64 VC11
Author
nphias



Joined: 22 Oct 2013
Posts: 2
Location: spain

PostPosted: Tue 22 Oct '13 16:32    Post subject: How to create apache 2.4 modules on win64 VC11 Reply with quote

I am trying to create an apache module for apache2.4.6-win64 downloaded from apachelounge.
I am coding in C++.. cant seem to work out what i am missing..
all documentation on creating modules from apache.org seems to be for linux..

does anyone have a basic sample module i could follow, modify, compile and run?
I am using visual studio 2012 express on windows 7 64 bit with VC11 update 3

what tools if any am I missing?
what are the steps?

thanks in advance
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Thu 24 Oct '13 10:26    Post subject: Reply with quote

The easiest is to use apxs (if you have it)
Code:

apxs -c mod_mymodule.c


Else if can be done by two lines (assume that your module name is mod_mymodule and in C:\Apache24 is the installed apache with the include and the lib folder.

Code:

cl -nologo -MD -W3 -O2 -c -DWIN32 -D_WINDOWS -DNDEBUG  -IC:\Apache24\include mod_mymodule.c
link /nologo /dll /subsystem:windows /machine:x86 /libpath:C:\Apache24\lib kernel32.lib ws2_32.lib libhttpd.lib libapr-1.lib libaprutil-1.lib /out:mod_mymodule.so mod_mymodule.obj


Than copy the mod_mymodule.so into the C:\Apache24\modules folder and enable the loading like the other modules.

Good luck.
Back to top
nphias



Joined: 22 Oct 2013
Posts: 2
Location: spain

PostPosted: Tue 19 Nov '13 14:35    Post subject: Reply with quote

steps

1. download apache2.4 win32 (apachelounge)
2. extract to c:\Apache24_32
3. install Activeperl
4. go to your visual studio express install - VC dir.. execute batch file vcvarsall.bat (64 bit) to put C compiler in path
5. download apxs_win32.zip tool from apachelounge copy apxs_win32 folder to root of apache folder
6. in the apxs_win32 dir, execute command: perl Configure.pl --with-apache2=..\ --with-apache-prog=httpd.exe
7. create a development directory with your module sourcecode eg mod_example.c
8. from dos prompt in apache/bin directory try to compile with apxs.. (note the version of the apxs tool is old and doesnt work very well)

eg:

apxs -c -l C:\Apache24_32\lib\libapr-1 -l C:\Apache24_32\lib\libhttpd -l C:\Apache24_32\lib\libaprutil-1 -l C:\Apache24_32\lib\apr-1 -l C:\Apache
24_32\lib\aprutil-1 -l C:\Apache24_32\lib\libapriconv-1 C:\Apache24_32\src_mod\mod_example\mod_example.c

the libpath feature of the tool doesnt work .. so you have to specify individually every library in the lib folder

at this point if you are extremely fortunate the module will compile to modulename.so (you will most likely need to change the source to be compatible with VC compiler)
You can then copy it to the apache/module folder
set the conf/http.conf settings:
- check server root location is correct
- log level debug
- add LoadModule example_module modules/mod_example.so (to the bottom of the list of modules)
- add the location handler (handler name should match in the source):
<Location /example-info>
SetHandler example-handler
</Location>
now start a one thread apache server from a dos prompt httpd.exe -X

If you even more fortunate (and this really is your lucky day), at this point the module will load and you can go to webpage and invoke it:
localhost/example-info

I have got this far, I now need to get it working for 64bit apache and try to build a far more complex module
which will then be converted to a language which is not c but generates a dll and apache headers.

good luck .. I certainly need it.
Back to top


Reply to topic   Topic: How to create apache 2.4 modules on win64 VC11 View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads