This article will discuss in detail how to setup a local Windows Apache, MySQL, and PHP (WAMP) development environment.
Prerequisites
Before proceeding, make sure you have at least 1GB of disk space available for the installation and have your Windows system up to date with the latest service packs. Also, it is recommended that you have at least 1GB of memory on your system and know how to administrate Windows services. This is so that you can turn services off to reclaim memory for your desktop computer use.
Download Application Servers
All application services will be installed on your Windows desktop system.
Select Custom Setup Type and turn on Building of Headers and Libraries
Install to C:\Apache\ (very important)
Click install
Look in the Windows start toolbar. The Apache Service System Tray Monitor should be installed. Click on it and turn on the server. Run your favorite browser and surf to http://localhost. If you see a "It works!" message, congratulations.
To make sure your internal domain name works, edit the /windows/system32/drivers/etc/hosts file and add the following:
Replace imysite.com with your internal domain name and save the file. Then, surf to http://www.imysite.com and http://imysite.com and make sure you get the same message.
httpd.conf Changes
It is recommended that you change the accessfilename to htaccess.txt instead of .htaccess to avoid any problems under Windows. It will also allow you to tweak Apache settings if you need to later. Go to your httpd.conf file and make the following change:
# Great for Linux/Unix but bad for Windows because of # period in filename #AccessFileName .htaccess
AccessFileName htaccess.txt
Then, create an htaccess.txt file and place all your Apache .htaccess directives, if you so desire. If it appears you are having difficulties getting your htaccess directives to be invoked, allow htaccess directives to be allowed.
Look for the directory directive and then change the override to "all":
<Directory "C:/Apache/Apache2/htdocs"> # Its none by default # AllowOverride None AllowOverride All </Directory>
Also, if you are working with websites that have a mixture of static html in say one site, and php in another, you may want to make appropriate directory index changes.
# I like to order static files first, then dynamic just in case # name collision which would render static sites useless DirectoryIndex index.htm index.php
Apache Virtual Hosting
Note (9/11/09):
Some versions of Apache may not require httpd-vhosts.conf. I tried version 2.0.63 recently and httpd-vhosts.conf did not exist. It appears that in versions 2.2 and above this is true. You can simply modify httpd.conf and place all virtual host configurations in there as described below.
Now we are going to setup virtual hosting. Virtual hosting allows for more than one domain to exist on the server. Go to the apache/conf/httpd.conf file and look for this line:
#Include conf/extra/httpd-vhosts.conf
Remove the pound sign so that it is enabled. Then go to apache/conf/extra/httpd-vhosts.conf and put in it the following:
Note that we create the ServerName to be the www part and preface the site name with an "i" for internal. We also create a non-www server alias. Another important point is that the Document root points to the folder where Drupal's index.php is installed.
In the example above, mysite1 and mysite2 are Drupal websites and mysite3 will be a non-Drupal website because it has a DocumentRoot that won't be triggered by Drupal's index.php bootstrapr.
Install And Setup MySQL
Run the MySQL Windows MSI installer
Setup configuration as follows
For setup type select Custom
Select all items in the list
Change installation directory to C:\MySQL
Check the "Configure the MySQL Server now" box and hit the finish button
Select Detailed Configuration
Choose Developer Machine
Choose Multifunctional Database
Choose C and Installatoin path as the InnoDB Tablespace path
Choose Decision Support (DSS)/OLAP
Enable TCP/IP Networking on port 3306
Enable Strict Mode
Choose Standard Character Set if you are English or Manual Selected Default Character Set/Collation and the approparite character set for your language
Install As Window Service "MySQL" and launch the MySQL Server automatically
Check off the Include Bin Directory in Windows PATH so you can access your MySQL admin applications later
Check Modify Security settings and choose the root accounts password
Bring up a DOS command prompt and type in the following:
mysql -u=usernamehere -p
Mysql will then prompt you for a password.
When the mysql admin program comes up, enter in "show databases;" and hit the enter key. There should be three databases installed (information_schema, mysql, and test).
If you desire, you can install the MySQL GUI Tools application which contains some nifty tools like the MySQL administrator, MySQL Query Browser, and the MySQL System Tray Monitor - highly recommended.
Install And Setup PHP
Run the PHP Windows MSI installer
Setup configuration as follows
Use C:\PHP\ as the install directory
Select Apache 2.2.x Module as the web server
Select the directory where the Apache config files are installed. This should be C:\Apache\ if you followed the instructions above correctly in installing Apache.
Choose all items to install (extensions, tools, etc)
After completion you need to go back into httpd.conf and make some changes. The PHP installer does not add the application type extension. This is a bug in the installer. Look for these lines at the very bottom and duplicate what is here:
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir "C:/PHP/" LoadModule php5_module "C:/PHP/php5apache2.dll" <--- filename AddType application/x-httpd-php .php <--- add this line #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
You should now be able to run on your local Windows computer a complete WAMP development environment. Happy developing!