adLDAP - LDAP authentication with PHP for Active Directory

SourceForge.net Logo

Apache - Configuring with PHP and LDAP

This is a guide to installing Apache with PHP, LDAP, and SSL. It presumes you have basic linux/unix administration skills. You will need to substitute version numbers where ever you see "version" in a syntax. This may look long and painful but it's really just running a serious of commands.

If you run into compile problems, google them and RTFM! This is a guide only, it does not come with technical support.

You really should install SSL and only use authentication over encrypted connections. If you generate your own certificate, your newly created Certificate Authority (CA) can be added to the trusted CA's in your domain through Group Policy (users won't receive security warnings about the authenticity of the certificate).

  1. Grab apache, php, mod_ssl, open_ssl and any add-ins (eg. postgre, mysql)
    For the purposes of this installation, the tarballs have been extracted to /usr/src/apache.

  2. Pre-Configure Apache
    ./configure --prefix=/usr/local/apache


  3. Configure and Compile Open SSL
    ./config
    make


  4. Configure Mod_SSL
    ./configure --with-apache=/usr/src/apache/apache_version/ \
    --prefix=/usr/local/apache \
    --with-ssl=../openssl-version


    Ignore mod_ssl’s suggestions to build apache when it’s finished configuring.

  5. Configure, compile, and install PHP
    If you need to add additional support to PHP, add the lines to the compile syntax. You will need to have a copy of the client programs for these modules to be installed for PHP to be able to use them.

    eg.
    For MySQL add: --with-mysql \
    For PostgreSQL add: --with-pgsql \

    For other options, please visit http://docs.php.net/en/configure.html

    ./configure --prefix=/usr/local/apache \
    --enable-exif \
    --enable-track-vars \
    --with-calendar=shared \
    --enable-magic-quotes \
    --with-ldap \
    --with-apache=/usr/src/apache_version
    make
    make install


  6. Configure, Compile, and Install Apache
    ./configure --prefix=/usr/local/apache \
    --enable-module=rewrite \
    --enable-shared=rewrite \
    --enable-module=most \
    --enable-shared=max \
    --enable-module=so \
    --activate-module=src/modules/php4/libphp4.a \
    --enable-module=php4
    make
    make certificate TYPE=custom
    make install


  7. Set Apache to start on post
    For Redhat based distributions, add the following to /etc/rc.local
    /usr/local/apache/bin/apachectl startssl

    For Debian and other similar distributions that do not have rc.local, copy /usr/local/apache/bin/apachectl to init.d and update your init scripts accordingly.

    If you've opted to use an encrypted private SSL key (which you should), you’ll need to put in a password whenever the server boots.

  8. Configure httpd.conf

    Change settings where appropriate, servername, admin, home directory, etc.
    Add the following to the end of /usr/local/apache/httpd.conf.

    ############## PHP ##########################
    AddType application/x-httpd-php .php .phtml .php3
    AddType application/x-httpd-php-source .phps
    ############################################