ServersReal-World Windows 2000 Configuration: Getting Apache, PHP, MySQL, and phpMyAdmin to...

Real-World Windows 2000 Configuration: Getting Apache, PHP, MySQL, and phpMyAdmin to Work Together, Part 1 Page 2

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

The Web Server: Apache – Installation and Configuration

More than half of all Web sites use the Apache Web server. For years, the stable Apache version was 1.3.x, and for a shorter period of time, 2.0.x was in development. In April of this year, Apache 2.0.35 was released and declared stable. One of its benefits is better cross-platform compatibility, including compatibility with Windows.

The current stable release of Apache 2.0 is 2.0.39. Windows binaries for it can be obtained from At the time of this writing, only a non-SSL Apache 2.0.39 build is available. Also, a non-SSL version of Apache 1.3.26 is available from the same page. (SSL stands for for Secure Sockets Layer, a security protocol for Internet messages. When you see a URL in your browser beginning with https:// you are using SSL.) If you have Microsoft System Installer, version 1.2 or greater (and it probably is already installed on your system), then either of these versions should install easily by double-clicking the .msi file that you can download. Please refer to the download page, and the installation information included with the distribution.

If you want to utilize Mod_SSL in order to add SSL capability to
your Web site, go to
and download
(or later) and (or later).
Also, download the sample config file, openssl.cnf, from
(right click the link, and select Save Target As… the filename

To install Apache with Mod_SSL, first create the directory
C:Apache. Then, extract the files in the
file, using a program such as WinZip.
Place these extracted files in the C:Apache directory.
Then, create a directory C:Apacheopenssl,
and a subdirectory, C:Apacheopensslbin. Move the config
file to C:Apacheopensslbin. Next, from the
file, extract openssl.exe to C:Apacheopensslbin,
and extract libeay32.dll and ssleay32.dll
to C:WINNTsystem32.

To create a test certificate for using SSL, open a command prompt window, enter a change directory command:

    cd C:Apacheopensslbin

and then enter the following commands:

    openssl req -config openssl.cnf -new -out localhost.csr
    openssl rsa -in privkey.pem -out localhost.key
    openssl x509 -in localhost.csr -out localhost.cert -req -signkey localhost.key -days 5000
    openssl x509 -in localhost.cert -out localhost.der.crt -outform DER

(Our sidebar article, “Creating Your SSL Test Certificate” offers additional information for those looking to set up an SSL test certificate.)

Then create a C:Apacheconfssl directory, and move localhost.key, localhost.cert, and localhost.der.crt into it.

Note: The selection of 5000 days to certificate expiration is arbitrary.

Apache 1.3.26 comes with a default configuration file, named httpd.default.conf. The actual configuration file that Apache uses is httpd.conf, which initially is the same as httpd.default.conf. These two files are found in C:Apacheconf. Keep the httpd.default.conf file unchanged, as a reference, and make the actual configuration changes to httpd.conf.

The following are the significant changes I made to the httpd.conf file provided with (Please note that forward slashes are used in the paths.) In some cases, the information is the same, but it is included here to answer any possible questions.

Changes to httpd.conf

ServerRoot "C:/Apache"

Listen 80
Listen 443

LoadModule ssl_module modules/
LoadModule php4_module C:/php/sapi/php4apache.dll

AddModule mod_ssl.c
AddModule mod_php4.c

# Port 80

ServerAdmin webmaster@localhost

ServerName localhost

DocumentRoot "C:/Apache/htdocs"

    UserDir "C:/Apache/users/"

    DirectoryIndex index.php index.htm index.html

#CustomLog logs/access.log common

CustomLog logs/access.log combined

ServerSignature Off

    Alias /icons/ "C:/Apache/icons/"


    # Alias /manual/ "C:/Apache/htdocs/manual/"

    #     Options Indexes FollowSymlinks MultiViews
    #     AllowOverride None
    #     Order allow,deny
    #     Allow from all

    # ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"
    # ScriptAlias /php/ "C:/php/"

    #     AllowOverride None
    #     Options None
    #     Order allow,deny
    #     Allow from all
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

# see for more info
SSLMutex sem
SSLRandomSeed startup builtin
SSLSessionCache none

SSLProtocol -all +SSLv3

SSLLog logs/SSL.log
# SSLLogLevel info
SSLLogLevel warn

SSLEngine On
SSLCertificateFile conf/ssl/localhost.cert
SSLCertificateKeyFile conf/ssl/localhost.key


Regarding running Apache from the command line:

To test the syntax of the httpd.conf file: at a command prompt in the C:Apache directory enter the command:

    apache -t

To start Apache: in the C:Apache directory enter the command:


To stop Apache: in a separate command prompt window in the C:Apache directory enter the command:

    apache -k shutdown

For more information, see

If you are interested in running Apache as a Windows service, the online documentation is at

Your Web site home page goes in the C:Apachehtdocs directory, as do the subfolders for your site.

To test your SSL connection when Apache is running enter the following URL in your browser’s address field:


A local copy of the Apache manual is included with the software. It is located in the htdocs folder. If you leave it there it will be available through your Web site. The manual for version 1.3.x is also available online at The online manual for version 2.0.x is at

The Windows shareware program that I like to use for comparing two versions of a configuration file is Compare It!.

If your browser recognizes but not http://localhost/, check your hosts file. For Windows 2000, go to the C:WINNTsystem32driversetc directory, and open the hosts file (there’s no extension to the filename) with a text editor. The uncommented line should read:       localhost

Discuss this article in the ServerWatch discussion forum.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories