I hope it proves helpful to the community. And, I would appreciate if any 'experts' out there were to take a look and make sure it's bullet-proof.
I don't quite know how to post formatted text here. But, here it is.
I hope this document proves helpful to others trying to learn. If any errors or oversights are noted, please bring them to my attention by PMSteedVLX’s “WAMP” Installation Walkthrough for Noobs Ver 0.1
So, you want to run a WAMP server? Well, if you are a relative newbie like me, you may want to read through this before you wind up vacuuming your hair off the floor or explaining to your wife where you got the bruises on your forehead. (Yes, it happened.)
WAMP is Windows Apache MySQL and PHP. In this walkthrough, we will be installing Apache 2.0.50, MySQL4.0, and PHP 5 on a Windows XP Professional system. DO NOT USE THESE INSTRUCTIONS FOR ANY OTHER COMBINATION. The features and directives are different. You have been warned.
FIRST Install Apache Server.
1. Acquire the Windows installation file from http://www.Apache.org/download.cgi . You want to download the “Win32 Binary (MSI Installer): apache_2.0.50-win32-x86-no_ssl.msi”. Save it to the folder of your choice.
2. The file is an MSI file, so simply double click it to begin the installation process. I highly suggest that you leave the default installation directory and other options as they are. While the MSI does a pretty good job of putting things where they belong, the consequences of changing defaults are simply that other, more detailed tutorials use the default installation directories to explain things. So, you’re better off leaving the defaults until you are versed in what’s going on IMO.
3. Now, since it is an MSI, you would think that they would ask some pretty obvious questions. Namely, Are you installing a database server? Are you installing PHP? But, it’s up to you to figure out where things are ‘supposed’ to be in these cases. (It was originally designed for UNIX-type systems after all. And, those guys KNOW what the heck they are doing.) So, simply put, for our WAMP server combination we need to first manually change the httpd.conf file in various places for things to work right.
a. Open the httpd.conf file for editing. Apache puts a link to it in the Apache HTTP Server menu in the ‘start’ menu for us console-challenged souls. Once open, make the following changes;
i. Find the ServerRoot directive and make sure that it is set to the directory where Apache is installed (Not where the .exe file is, but the main directory). This is usually “C:\Apache Group\Apache2”.
ii. Next, you need to add the following lines;
Add LoadModule php5_module c:/php/php5apache2.dll to the bottom of the LoadModule section. We have not installed PHP yet, so starting the server will give you an error. However, the server will start anyway. (Trust me)
iii. Next, in “Main Server Configuration”, change the ServerAdmin directive to the email address that you want to use as the webmaster email. i.e. ServerAdmin webmaster@localhost.com
iv. Change the ServerName directive to either the www address of your server, or its IP address. Indicate the port you want to use as well, usually port 80. i.e. ServerName http://www.myhost.com:80
You may also specify http://www.localhost:80 if you wish
v. Set DocumentRoot to the directory where you will be serving files from. The default is in the Apache2\htdocs directory. But you may change it to any existing directory you like.
i.e. DocumentRoot "D:/ftproot/myhost/htdocs"
vi. The <Directory> Entry must be changed to the same thing you put in the DocumentRoot directory just in a slightly different format.
i.e. <Directory "D:/ftproot/myhost/htdocs">
vii. The DirectoryIndex must be set to include php files (when we get it installed) Do this by adding index.php to the list of files in the directive.
i.e. DirectoryIndex index.php index.html index.html.var
viii. Lastly is the AddType directive. You must add two lines here.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
4. Apache doesn’t really have much to do with MySQL, so there is nothing to do here. That’s another nightmare altogether… Unless of course you have someone to walk you through it.
That’s it! Apache is now installed.
Now. Let’s get down to installing some serious modules. Everything for Apache to use PHP has now been changed in the httpd.conf file. But, now we need to actually install the PHP5 and MySQL4 packages.
SECOND Install MySQL.
1. Download the latest production version of MySQL4 from the official MySQL download site, http://dev.mysql.com/downloads/. And, save the zipped file to a local folder.
2. Unzip/extract the contents of the package to a subdirectory, and execute the Setup.exe file contained there. Leave the default installation directory as C:\MySQL. It will save you quite a few headaches and presents no security issues in itself.
3. When the installation completes, we need to do some initial busy-work and configure the my.ini file. So, here we go…
a. First, the my.ini file. This file must be located in the X:\Windows (or C:\WinNT) directory. If you are on a bootloader system or for any reason your windows system drive is not ‘C:’ then you replace the above X with the windows system drive. We will create this file in notepad. Type the following into the file and save it as my.ini
[mysqld]
# set basedir to your installation path
basedir=D:/mysql
# set datadir to the location of your data directory
datadir=D:/mydata/data
4. Next, we will make sure the server is not actually running. Open a console window. (Yeah, I know, scary stuff. But, don’t worry.) Type the following;
cd\mysql\bin (This changes you to the MySQL scripts directory)
mysqladmin -u root shutdown (This makes sure the server is not running)
mysqld - - install (That’s a double dash with no spaces between them)
a. You should have gotten a message indicating that MySQL was successfully installed as a ‘service’. It will now start and stop automatically with windows.
5. Now, let’s test it and make sure it has a heartbeat.
In the same console window type;
mysqld –console
You should see messages indicating that the server is ‘ready for connections’. Since this is the first time to start it up, you may see many more lines of messages indicating that certain things were not found but they were created. Take a look. You won’t see these messages again.
a. Leave that console window open and running, and open a second one and change to the C:\mysql\bin directory. Now, type each of the following commands and take a look at the output. There should be no errors, just some not-so-interesting output boxes and such.
mysqlshow
mysqlshow -u root mysql
mysqladmin version status proc
mysql test
6. If your output is error-free, you are ready to proceed. If you get errors, especially a access denied error, you need to chase it down in the documentation. But, everything should go well.
7. Type mysqladmin –u root shutdown in the second console you opened. Then watch the first one for the shutdown messages. Then exit/close the console windows. And, (Now, that wasn’t so bad was it?)
That’s it! MySQL4 is now installed.
THIRD Install PHP5
Now comes the tricky part. PHP5 is the least helpful and least intuitive installations we have to face. It involves not just getting the installation in the right place. But, many files must be moved to various areas of the system to get everything plugged in. And, the package doesn’t even include the docs, so make sure you have a ‘connected’ system on hand to access the online docs. PHP has been described as the ‘glue’ that holds LAMP and WAMP server software together. So, just like glue, we need a gob here and a dab there to do the trick. Here we go! Hang on tight!
1. Download the latest Windows Binary from http://www.php.net/downloads and save it to a local folder. It is a good idea to download the documentation as well while you are there. This process assumes you are installing from a zipped archive (PHP5.x.x-Win32.zip) and installing PHP as thread-safe SAPI and not as a CGI module.
2. Extract the contents of the package to C:\PHP. Among the files, you will find install.txt which indicates that there is a InstallShield version of the PHP installer out there somewhere. As of this writing, no such installer is available for PHP5. Or, at least I couldn’t find it.
3. Locate the php.ini-dist in the C:\php folder and copy it to C:\WINDOWS folder (Not the SYSTEM32 folder as some docs may seem to indicate).
4. Rename php.ini-dist to php.ini and open it for editing in your favorite editor. (CAUTION: When saving plain text files, notepad will try to automatically stick an extra ‘.txt’ to the end of the filename. Make sure you remove it before saving the file or PHP will be unable to function and you will be pulling hair trying to figure out why.)
5. Make the following changes to php.ini;
a. Change extension_dir = to "C:\PHP" (including quotes) optionally, you can sometimes leave it as “./” but this may break some scripts across the network, Not really sure why.
b. Next, scroll down to the Windows Extensions area. You will see a long list of entries like extension=php.xxx.dll. Uncomment (remove the ‘;’ from) the line that says extension=php_mysql.dll
c. Now, go to the C:\PHP folder and copy the following files to the C:\WINDOWS\SYSTEM32 folder. These are the mysql libraies needed to communicate with the MySQL server;
i. Libmysql.dll
ii. Libmysqli.dll
iii. Php5apache2.dll
iv. Php5apache_hooks.dll
v. Php5ts.dll
vi. Php5isapi.dll
Just restart the system and test your configuration by placing a simple php script in the web servers document root that calls the phpinfo() function. If this loads, then all is well. You can now perform advanced and security-related configuration to your new WAMP server.
Thank You.
My gift to all those out there vacuuming their hair off the floor before it gets stuck in the air intake fans. Please let me know if there are any edits that need to be made. I will maintain it as long as there is an interest in it