Building Apache modules on Windows
I wanted to add SCGI support to Woof! under Apache on Windows. Not finding a suitably recent version of a mod_scgi binary for Windows, I thought I would build it myself. The eventual steps were simple enough but for someone building an Apache module for the first time on Windows (Linux is better documented and simpler) getting there was a bit of a runaround of following broken links and outdated information.
So here are the steps for future reference:
- Download an Apache installer for Windows and install it. I installed into the default location C:\Program Files\Apache Software Foundation\Apache2.2
- Install a suitable (almost any will do) Perl package for Windows. I used the one from ActiveState. You need this to run the
apxsbuild tool. - Download a Win32 version of
apxs- the APache eXtenSion tool. Extract it into a temporary directory and follow the instructions in its README file to install it into the Apache tree. - Run vcvars32.bat if necessary to set the Visual C++ environment variables.
- Modify the
mod_scgiMakefile as shown below (only modified lines shown) and typenmaketo build.
APXS="C:\Program Files\Apache Software Foundation\Apache2.2\bin\apxs.bat" APACHECTL=apache2ctl APACHELIBS=libhttpd.lib libapr-1.lib libaprutil-1.lib all: $(APXS) -c mod_scgi.c $(APACHELIBS) # XXX should not need the -c option but for some reason it's required :-( install: $(APXS) -i -c mod_scgi.c $(APACHELIBS)
My belief is that setting of APACHELIBS should not have been necessary but on Windows the build would fail otherwise. Copy the built mod_scgi.so into the Apache modules directory. Done.
A binary distribution, built using the above steps, is available from the Woof! SourceForge site.
- ashok's blog
- Login to post comments
