Compiling Apache 2.2.x with LDAP Support
My one gripe with the Apache documentation is that one often needs to interpret it because the meaning behind something isn't always generally obvious. Although it may be crystal-clear to the developer documenting the module or setting in question, it is not always clear to the user—especially if you are new to compiling apache.
Take compiling LDAP support into recent builds of apache 2.2 as an example. If you read the
configure --help output, it would only be natural for one to assume that all you need to do is run:
./configure --enable-ldap --enable-authnz-ldap and you will end up with an apache web server that supports ldap and that can use ldap databases for user authentication. If you've never compiled apache before though, running configure with these options will not give you that support.
Looking at the documentation for mod_ldap, I find this:
To enable this module, LDAP support must be compiled into apr-util. This is achieved by adding the
--with-ldap flag to the configure script when building Apache.
--with-ldap flag to your
configure options will still not give you a working apache server with ldap support if this is your first compile. I suspect that
--with-ldap doesn't actually do anything any more although I have not tried it yet compiling against the apache httpd 2.0 source. With the latest Apache 2.2.11 source, though, results are not what you would expect.
What isn't immediately clear here and what isn't all that well documented at least on the apache httpd site, is that when you run the configure script, not only are you compiling apache httpd but you are also compiling the apache apr and apr-util libraries. In order to get LDAP support into apache, you need to compile that LDAP support into apr first and then apache httpd will be compiled against your newly created apr/apr-util. So, although the
--enable-ldap-authnz configure options are valid for adding ldap support into apache, you also need to pass the
--with-included-apr option in order to actually get it to work. At least, that's what I needed to do. Please let me know if any of you finding this page via Google were able to meet success by adding the
--with-included-apr flag to your configure script.