Set up a Windows test server using XAMPP
XAMPP for Windows makes setting up a local test server on your computer very easy. As well as providing the WAMP stack (Windows, Apache, MySQL and PHP) it includes both PHP versions 4.x and 5.x which you can easily switch between. It also includes PHPMyAdmin which is very useful for dealing with your MySQL databases.
(NOTE: XAMPP is only intended for use as a local test server which is available on your own computer. It has been created for ease-of-use, but not for production level security. If you want to tinker with security here is a guide about making XAMPP secure.)
Installation
The installation of XAMPP is very straightforward. Rather than repeat the installation instructions here, just follow the instructions on the XAMPP site
Once you have downloaded and installed the package you may like to do some further configuration...
Configuring XAMPP
Creating virtual hosts
If you do not want to keep your files in the xampp/htdocs directory and type in a long URL for every page load, you can create virtual hosts for each of your sites instead. For example, you may like to keep all your sites in your My Documents folder for easy backup. Or you could create a root directory on your hard drive such as c:/sites/example/ which will make using shell commands easier. Wherever you choose to store your sites, you can always easily move them at a later date.
With XAMPP you set up virtual hosts in the following file:
\xampp\apache\conf\extra\httpd-vhost.conf
Open up that document in your text editor and append the following information to the bottom:
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot C:/xampp/htdocs/
ServerName localhost
</VirtualHost>The above only needs to be added once and you don't need to change any details to the above.
The next step, however, needs to be carried out for each site. Copy the code below and add it to the bottom of the file.
<VirtualHost example.local>
DocumentRoot "C:\path\to\your\site"
ServerName example.local
CustomLog "C:\path\to\your\site\logs\example.local.access.log" combined
ErrorLog "C:\path\to\your\site\logs\example.local.error.log"
<Directory "C:\path\to\your\site">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>You will need to makes some alterations for your personal setup.
Where it says example.local put the URL you would like to type into your browser to find your site. You can call this what you like, but make sure it relates to the site you are creating and is not a real URL that you may like to access on the Internet otherwise you will get a namespace clash. Using the production site's URL but replacing .com or whatever with .local works well.
Where it says "C:\path\to\your\site" add the directory where your site is going to be stored on your local drive. Note that you should NOT include a slash on the end of the path. You can also set up a place to keep error and access logs for these sites. You will need to create the directory structure for these, but not the individual files (i.e. create the directory structure C:\path\to\your\site\logs but Apache will create the example.local.error.log file for you).
Finally you must include the domain names in your Windows host file. This file can be found at:
C:\WINDOWS\system32\drivers\etc\hosts
open this file in your text editor and add:
127.0.0.1 example.local
You can repeat this procedure for as many sites as you wish.
When you are done, restart Apache.
Clean URLs
You will also probably want to enable clean urls. To do this in XAMPP, open up xampp\apache\conf\httpd.conf and find this line:
#LoadModule rewrite_module modules/mod_rewrite.so
and uncomment it by deleting the hash (#) so that it reads:
LoadModule rewrite_module modules/mod_rewrite.so
Restart Apache and test that clean URLs work on your site. If this doesn't work for some reason, follow the instructions on this handbook page

VirtualHost Tag
For me I had to put
<VirtualHost 127.0.0.1:80>
DocumentRoot "/path/to/your/site"
ServerName example.local
...
...
</VirtualHost>
for each vhost and not put the domain name in the VirtualHost tag.
Also by not putting the disk label in it runs fine with XAMPP Portable.
Allowing Other LAN Users to See Site
I followed the above instructions and everything worked perfectly. However, I am at a small business where we have a LAN. When I had drupal installed within XAMPP htdocs, any LAN user could go to http://mycomputer_name/drupal and see the site.
Now that I've moved everything to my My Documents folder and set up the virtual host, I can see the site at http://example.local/ but no one else can.
Do I need to add
127.0.0.1 example.local
to everyone's C:\WINDOWS\system32\drivers\etc\hosts file?
exmaple.local info
Do I need to add
127.0.0.1 example.local
to everyone's C:\WINDOWS\system32\drivers\etc\hosts file?
Answer.
You need to find out what your IP address is and replace 127.0.0.1 with it. You shouldn't use this outside a local network behind a firewall as this software setup isn't secure.
Thanks
Robert
log files
If you don't have directories setup for log files and you have these lines in:
CustomLog "C:\path\to\your\site\logs\example.local.access.log" combined
ErrorLog "C:\path\to\your\site\logs\example.local.error.log"
Apache won't start. If you're not sure if it's not restarting because of this, check your Apache error logs here: C:\xampp\apache\logs\error.log
If you want to make sure you didn't put something in wrong in your Apache configuration files, open the Command Prompt, go to c:\xampp\apache\bin and type apache -S for Apache to check your config files.
Another way via Winlamp
Hi all
There is yet another way to set up a test server.
I recently wrote a series describing step by step how to install a drupal test site on windows using winlamp.
Easy to follow and current.
http://www.cmstips.org/content/set-free-drupal-test-site-your-pc-winlamp...
Drupal Tips
Create DoFollow Blog Listing
Use of forward and backward slash
Hi, I tryed the virtual hosts in your example and clipped right from the page, seemed to work ok, but when I tried to use sub-directories in them and they would not work, I looked and looked around with no answer, then it dawned on me that its the slashes, then looked and most sites with virtual host examples showed using forward slashes, then I findly looked in Apache DOC later by a search on google for apache file name slash problem found the apache doc, and it says:
Note
When entering a file path on non-Unix platforms, care should be taken to make sure that only forward slashed are used even though the platform may allow the use of back slashes. In general it is a good idea to always use forward slashes throughout the configuration files.
Who would Know but them to always use forward slashes on all configuration files. easy mistake to make when you clip paths to config files in windows. So your second example is wrong above, now my sub-directories work
The apache mad slash disease. I guess if I used linux more often id know.
Bill Stark
SPC student
Xampp Version Needs to be posted here!
There directions are lovely, but NOTE when you click for the next page to start the Drupal install directions, the first line reads that Drupal 6 does not work on Xampp 1.7.2!!!
It needs to be noted on this page that the lastest version of Xampp SHOULD NOT BE INSTALLED and that version 1.7.1 should be, which is also a bit tricky to find. I managed to find it at http://sourceforge.net/projects/xampp/files/ but note that Xampp for Windows is a long way down the page and then you have to click on the version and the actual windows version appears below the MacOS version.
I have now spent more than 7 hours trying to rectify this first step blunder! Despite uninstalling 1.7.2, installing and reinstalling 1.7.1, I cannot get Apache actually running!
Being on a Windows Vista OS may have compounded things, but steps I've taken so far to try and get Apache working are:
- Turning off the Internet Information Services (found in the Control Panel)
- Confirming the "path to executable" for Apache in Windows Task Manager > Services is correct.
- Turning off User Account Control.
- Running Xampp's port scan program to confirm that Port 80 is available (which it is, but Apache cannot run). Verifying Xampp's port scan with another softwar (ScanPort).
- Changing Windows Firewall Settings to allow Apache through.
And I still cannot get Xamp working. So still cannot actually move on to my goal of installing and using Drupal.
If the version was clearly stated on this page, then all of the above could be avoided.
Hope this helps others.
Yes 1.7.1 is right Candidate !
On Win XP, REINSTALLING the whole configuration in 1.7.1 sorted out my problems of Drupal installation.