Running a Drupal site locally under Windows XP

There are many reasons for running a copy of a Drupal website on a local machine among them backup, offline development or more likely a perverse desire to show that it can be done. The perversity is hightened by doing this on a Windows machine, in this case Windows XP. This case study is based on the real world user "varley" and the site "". You may get your case to work with appropriate substitions.

We need Apache, MySQL and PHP to create an environment like that on a production server. We can get that for Windows from There are others. This one works. Note: Wampserver 2.0h is out with fresh versions of everything. Hopefully that will fix a problem with myisamchk and wildcards present in an earlier version. It does upgrade PHP to fix a security vulnerability.

I tried building a WAMP stack from scratch (binaries). Ran into configuration issues after downloading more than 200MB. Wampserver is a little over 16MB and does the basics.

Install it and test by going to the URL http://localhost.

You will need one small modification to get Apache to work with Drupal and that is to enable "rewrite" in C:\wamp\bin\apache\apache2.2.11\conf\httpd.conf by removing the "#" in front of the following line:

LoadModule rewrite_module modules/

Note: the version numbers will change and are used in the file hierarchy so you will have to adjust paths throughout. The simplest way to find the correct paths is to use the Windows XP Search command.

You will need to create a user and database with the same passwords and permissions at the production server. Go to http://localhost/phpmyadmin/ Click Privileges, Add a new user. Creating the database is left as an exercise.

If you do change the mysql root user password and find yourself locked out, change the password in C:\wamp\apps\phpmyadmin3.1.1\ e.g. $cfg['Servers'][$i]['password'] = 'new_password';

Now get your database. In our case, we go to the URL log in, select our database, choose export. Check the Add DROP TABLE/DROP VIEW, Save as file and Go. Put the file in c:\

The maximum size file thaqt can be imported is constraqined by the line max_allowed_packet=1M in C:\wamp\bin\mysql\mysql5.1.30\my.ini. My "sql" file is 30MB so I set my_allowed_packet=64M. If your database gets too large to handle in this fashion, there are some options. Clear "cache", truncate the logs, download in pieces.

Then run the  following command.  

C:\wamp\bin\mysql\mysql5.1.30\bin\mysql.exe -uroot -ppassword drupal </drupal.sql

We didn't use the Import feature of phpMyAdmin because it runs like a dog and you are lucky to get it to run at all with the default settings in phpForApache.ini. Adding the Wamp binaries to the "path" would be a neat trick but the allotted space for the "environment" variables is small and the process of adding to the path is fraught with pits.


Now we need the website proper. We will use the tool WinSCP to copy  the entire website to the directory C:\wamp\www Because there are so many files, the handshaking will take a long time. It would better to tar and compress on the server, download a single file and expand on the local machine but that would require more tools and more intellectual investment. This ia a good time for a nap.

To tell Apache about our website we need to create a "virtual server". Wamp loads every file in c:\wamp\alias to httpd.conf so we will create the stanza there. I choose to name that file but anything that serves  your memory is fine.

<VirtualHost *>
    DocumentRoot "c:/wamp/www/varley/"

	<Directory "c:/wamp/www/varley/">
		allow from all
                AllowOverride AuthConfig FileInfo Indexes Limit Options
                Options FollowSymLinks SymLinksIfOwnerMatch +Indexes

    ErrorLog c:/wamp/logs/
    TransferLog c:/wamp/logs/

Only one detail left. We want to direct our browser to our virtual server running on localhost and the way to do that is to add a line to c:\windows\system32\drivers\etc\hosts.

Now we can use the little WAMPSERVER helper (execute wampmanager.exe if it doesn't appear in the system try) and "Restart all services".

Point your browser to and if I haven't missed anything you should see your website locally.