Search code examples
phpapachesslhttpsxampp

Setting up SSL on a local xampp/apache server


I'm trying to access a Active Directory from my local webserver. To do this I'm using the latest version of xampp and a PHP script called adLDAP. If I understand things right, I need to enable SSL to access https URLs. I've tried to google it but with no luck :( Could anyone link a tutorial or explain to me how to install SSL on xampp/apache for windows 7 64bit? Any help would be appreciated :)


Solution

  • Apache part - enabling you to open https://localhost/xyz

    There is the config file xampp/apache/conf/extra/httpd-ssl.conf which contains all the ssl specific configuration. It's fairly well documented, so have a read of the comments and take look at http://httpd.apache.org/docs/2.2/ssl/. The files starts with <IfModule ssl_module>, so it only has an effect if the apache has been started with its mod_ssl module.

    Open the file xampp/apache/conf/httpd.conf in an editor and search for the line

    #LoadModule ssl_module modules/mod_ssl.so
    

    remove the hashmark, save the file and re-start the apache. The webserver should now start with xampp's basic/default ssl confguration; good enough for testing but you might want to read up a bit more about mod_ssl in the apache documentation.


    PHP part - enabling adldap to use ldap over ssl

    adldap needs php's openssl extension to use "ldap over ssl" connections. The openssl extension ships as a dll with xampp. You must "tell" php to load this dll, e.g. by having an extension=nameofmodule.dll in your php.ini
    Run

    echo 'ini: ', get_cfg_var('cfg_file_path');
    

    It should show you which ini file your php installation uses (may differ between the php-apache-module and the php-cli version).
    Open this file in an editor and search for

    ;extension=php_openssl.dll
    

    remove the semicolon, save the file and re-start the apache.

    see also: http://docs.php.net/install.windows.extensions