Whether you are a web developer or just a blogging maniac you need a place to test changes (like a new version of your blogging software, content management system, etc...) to your site before you upload and make those changes known to the world. The way to do that is by installing the software you have on your server. It is best to mimic your server as close as possible but it is not always possible to do. For instance, most apache + php + mysql installs run on linux or some form of unix but most people are not familiar those systems so the next best thing is to run it on a platform you are familiar with and let everything else mi mick the server. With that said lets get on with building our test server.
Apache 2.0
download the Win32 Binary (MSI Installer) at http://httpd.apache.org/download.cgi
php 4.4
download the zip version at http://www.php.net/downloads.php
mysql 4.1 or earlier
download at http://dev.mysql.com/downloads/mysql/4.1.html for MySQL 4.1 or http://dev.mysql.com/downloads/mysql/4.0.html for MySQL 4.0. I am using the Windows (x86) 4.1.20 38.9M version. If you have a dial up connection go ahead and download the Windows essentials version. I have highlighted the version I used in this tutorial. NOTE: MySQL 4.1 does not work with PHP4 without a workaround. I have used MySQL 4.1 here to demonstrate the workaound

This tutorial will guide you through the basic install and configuration of apache, php and mysql. Since everyone will need a different configuration and have different security needs we will not make in any security considerations. In saying that you should use this test server protected behind a firewall.
Install Apache
Double click on the apache installer that you downloaded and lets step through the install process
![]()

The "Welcome to the Installation Wizard for Apache HTTP Server 2.0.58" appears. Click "Next"

The "License Agreement" appears. Read the terms and click "I accept the terms in the license agreement" (only if you agree with the terms of course )

The "Read This First" dialogue box appears. Read it if you want and then click "Next". I know this is boring but we're making progress. :)

Finally, the "Server Information" dialogue box appears, a box that actually does something. Enter your "Network Domain", "Server Name" and "Email Address" in the appropriate fields (feel free to use the ones I have entered for the sake of following along) and leave the server to run for "All Users, on Port 80, as a Service -- Recommended" assuming that you are not running another web server or anything else on port 80.

The "Ready to Install the Program" dialog box appears. Assuming you have entered everything as you want it click "Install".

The "Installing Apache HTTP Server 2.0.58" dialogue appears and displays the installation progress.

Once the install is complete the "Installation Wizard Completed" dialog displays. Click "Finish" and you are done with the install. Pretty painless so far wouldn't you say? Well assuming you didn't die from boredom. :)

Now for the first exciting step. Fire up a browser and see if it works. in the address field in your web browser enter http://localhost/ and you should see the page above.
Okay. You may have noticed that I pulled a fast one on you and you may be wondering why we had to enter localhost if we entered "testserver.xyz" in the "Server Information" dialogue box. Well let me first say congratulations on your first Apache httpd web server install. Now lets address what the server name issue.
Now you should know that apache serves web pages very well but it doens't know the first thing about NAME RESOLUTION. Apache relies on your operating system to do that for you. When you type in an address such as dezinedepot.com in the address field in your browser your operating system works some name resolution magic. This magic is usually done trhough the DNS resolver but we aren't about everyone else having access to our private little test server so we can put our host names in a file named hosts. In fact it already exists on your system you just need to add your fictious host name to it so launch Windows Explorer (or double click on "My Computer" on your desktop) and navigate your way to this directory
C:\WINDOWS\system32\drivers\etc
and you will see the hosts file:

Open the file in notepad.exe to edit the file (do not use word or complex text editor as they will change the format of the file render it useless). To open the file in notepad simply right click on the hosts and select notepad from the list of editors. If notepad is not listed double click on the hosts file and you will be prompted with the dialogue box shown below(oh no! not more dialogue boxes!). Click the radio button "Select the program from a list" and then click the "OK" button.
The "Open With" dialogue box appears. Select Notepad and click the "OK" button
Once you have the host file open it should look something like the that pictured above. The lines that start with # (otherwise known as the pound sign, number sign, hash or octothorp) are considered comments and are ignored by the operating system. However the file is broken up in to two main columns. The column on the left side is the machine (or host) IP address and the column on the right are the host name or names that correspond to that IP address. All computers have at least once IP address even if they are not connected to the Internet and that address is called the LOOPBACK ADDRESS with the special IP of 127.0.0.1. As you can see the host name localhost is already there. We can add another host name by adding a space or tab after localhost, but on the same line, and entering "testserver.xyz" as shown below:

Now launch your web browser and type in testserver.xyz in the address field and you should get the same page you got when you entered localhost. Cool huh? Nobody else can reach your server by the name you gave it in the hosts file because only your system reads that hosts file. If you want everyone to reach your server by that name you must use a Domain Name Server (DNS server) which is way beyond the topic of this tutorial. Make sure whatever name you enter in the hosts file isn't a server in real life otherwise you will never be able to reach it. Go ahead and try it. next to enter this in your hosts file
127.0.0.1 localhost testserver.xyz google.com
now try to go to google.com in your web browser. Is google installing apache too or is that our test server? Yeah yeah. pathetic attempt at humor but you get the point. Remove the google.com entry from the hosts file and save it again.
Now you can put any file in the C:\Program Files\Apache Group\Apache2\htdocs directory and it will be served up by apache. Go ahead and create and index.html file and cut and paste this in it
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>my testserver.xyz page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h2>It works! </h2>
</body>
</html>
Now point your web browser at http://testserver.xyz and you should see the test page. Could this be any more exciting? We are making some progress now. If you are going to create static website that don't require php or mysql you are pretty much done. You can play around with the httpd.conf file to adjust configuration options to suit your needs and enable some modules but that is all user specific. Head on over to httpd.apache.org and look up the configuration options to find out all the power that is apache.
{mospagebreak}NOTE (stated again for effectiveness): MySQL 4.1 does not work with PHP4 without a workaround. I have used MySQL 4.1 here to demonstrate the workaound.
The MySQL installer is pretty self explainatory so I would look over this page and get an idea of what to expect from the install and then go for it. This installation guide will show you the kind of questions you should be prepared to answer (mostly in the configuration part of the install).
Now extract the setup.exe file from the mysql-4.1.20-win32.zip file.

double click on the setup.exe file to start the mysql installer
you will see the "Extracting installation files. Please wait..."

click "Next"

Choose "Custom" for the setup type and click "Next"

Leave the installed features (packages) as they are. Click the "Change" button

Change the install directory to C:\MySQL\MySQL Server 4.1\ and click the "OK" button. (NOTE: you can install mysql in the default location or wherever you like but I prefer it closer to the root of the hard drive in the event I need to navigate to it via the command line)

The "Install to:" should now indicate the new directory C:\MySQL\MySQL Server 4.1\

The next dialogue box indicates the installation parameters we have chosen. Click the "Install" button if everything checks out ok.

The Mysql setup wizard progress bar appears.

You can create or login to your mysql account at this stage. If you not in the mood select "Skip Sign-Up" then click "Next"

MySQL gets easier to install and configure all the time. The intaller launches the configuration wizard so you can answer some questions and MySQL will create the configuation options for your environment. Make sure the "Configure the MySQL Server now" check box is checked and click "Finish"

The MySQL Configuration Wizard appears. Click "Next"

Select "Detailed Configuration" and click "Next"

Since this is a test server select "Developer Machine" (MySQL will use the minimal resources when you select this option. However a dedicated MySQL server should use as much resources the server can spare)

MySQL will next ask you what type of storage engine will be used. Most people can get away with selecting "Non-transactional Database Only" as most content management systems, blogging software, et cetera only use the MyISAM storage engine. If you need InnoDB storage engine or you aren't sure then you probably select "Multifunctional Database" as I am in the tutorial. It covers the bases

MySQL asks if you would like to put the InnoDB datafile somewhere other than the default. I accepted the default and just clicked "Next"

Select "Decision Support (DSS)/OLAP" This will keep or resource requirement down but allow for 20 concurrent connections. This is good for testing in a workgroup situation. Feel free to use the "Manual Setting" instead.

Leave this setting enabled and keep the port on 3306 if it is not already taken. This will allow you to connect to the MySQL server from a remote machine. If you don't require this disable it.

If you need to support many different languages then you want to select "Best Support For Multilingualism". I selected "Standard Character Set" and clicked "Next"

Enable "Install As Windows Service" - This means the Windows operating system will start MySQL at boot time rather than you clicking on an icon (shortcut) in the "Start Menu".
Enable "Include Bin Directory in Windows PATH" - This will allow you to use the MySQL command line tools from any directory on the command line instead of having to navigate to C:\MySQL\MySQL Server 4.1\bin.
root
is your adminstrator user that rules over MySQL. This is where you assign you
root user a password. It is safest not to have root access from remote machines
but I'll leave that up to you. I would not recommend enabling "Create An
Anonymous Account". I'll show you how to create new users and databases
later. Click "Next"

The MySQL Install Wizard let you know that it is ready to install. Click "Execute" to let MySQL step through its configuration process.

The MySQL Install Wizard tells you that the configuration file was create, Windows server MySQL installed, Service started successfully, Security settings applied. Click "Finish" and we're done!
Lets see if our database is working as expected.

We can reach the mysql client from the start menu like this but I prefer another method

Click the "Start" menu button then click "Run"

type in cmd (for command line) and press enter (or click "OK")
at the command prompt enter the following:
mysql -u root -p
you will be prompted for the password you entered in the the install. enter it and you should get be logged in to the mysql server with a new mysql> prompt. Next enter
show databases;
make sure to end the line with a semicolon ";". MySQL client expect every statement to end with a semicolon. If no semi colon is entered and you press the enter key you will go to the next line but you will still be entering the same statement.
Now lets create a new database. Enter
CREATE DATABASE myfirstdb;
and press enter. That is great but nobody has access to it yet but root. We'll create a new user and assign him permissions to myfirstdb. To do that enter
GRANT ALL ON myfirstdb.* TO dev@localhost IDENTIFIED BY "agoodpassword";
Now user dev has permission to do anything and everything to the database myfirstdb as long as he is logged on to the local computer.
This exchange looks like this:

You can use these commands to create any database and an assign a user to it with any apssword by substituting
myfirstdb - with the your database name
dev - with your username
agoodpassword - with your own password.
{mospagebreak}There are two ways to install PHP on Apache 2:
1) as a CGI
2) module (or sapi module)
warning PHP4 does not work with MySQL 4.1 or later. MySQL 4.1 and later uses an authentication protocol based on a password hashing algorithm that is incompatible the MySQL client used in PHP4. PHP5 is compatible and requires no workarounds. Solutions are use MySQL 4.0 or earlier or PHP4 can use MySQL 4.1 as long as you:
From the mysql.com site
Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:
mysql> SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Alternatively, use UPDATE and FLUSH PRIVILEGES:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') WHERE Host
= 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

When you download PHP from php.net the options above are presented to you. Select the zip package. It is the only way to install PHP as a module which runs faster than the cgi version and it is also easier to upgrade later when needed.

once you have downloaded the zip file unzip (extract) it on your computer.

You should end up with a folder like php-4.4.2-Win32 on your computer. Copy the folder that contains the php.exe binary directly in it.

Paste the folder in the root of your C:\ drive as pictured above.

Rename the folder you just pasted from php-4.4.2-Win32 to simply php. Your directory structure should now look like this:
c:\php
|
+--cli
| |
| |-php.exe -- CLI executable - ONLY for commandline scripting
|
+--dlls -- support DLLs required by some extensions
| |
| |-expat.dll
| |
| |-fdftk.dll
| |
| |-...
|
+--extensions -- extension DLLs for PHP
| |
| |-php_bz2.dll
| |
| |-php_cpdf.dll
| |
| |-..
|
+--mibs -- support files for SNMP
|
+--openssl -- support files for Openssl
|
+--pdf-related -- support files for PDF
|
+--sapi -- SAPI (server module support) DLLs
| |
| |-php4apache.dll
| |
| |-php4apache2.dll
| |
| |-..
|
+--PEAR -- initial copy of PEAR
|
|
|-go-pear.bat -- PEAR setup script
|
|-..
|
|-php.exe -- CGI executable
|
|-..
|
|-php.ini-dist -- default php.ini settings
|
|-php.ini-recommended -- recommended php.ini settings
|
|-php4ts.dll -- core PHP DLL
|
|-...

Copy php.ini-recommended and paste it in the same directory (i.e. C:\php).

Rename the copy from Copy of php.ini-recommended to php.ini

Navigate to C:\Program Files\Apache Group\Apache\conf and open httpd.conf.

Edit the line that starts with DirectoryIndex index.html index.html.var.

Remove index.html.var and enter index.php It wouldn't be a bad idea to add index.htm on the line too.

restart apache by left cllicking on the tray icon and clicking Apache2->Restart
create a file called mytest.php that contains the following
<?php phpinfo(); ?>
place mytest.php in the C:\Program Files\Apache Group\Apache2\htdocs directory and direct your web browser to http://testserver.xyz/mytest.php and you should end up with the following page:

Congratulations your php install is complete!