Here are the steps you need to take to get a copy of a Drupal website onto your local computer for development purposes, using the XAMPP stack and a variety of tools. Many of the steps taken here have been made so that you can keep your PHP files outside the standard
htdocs DocumentRoot directory of the Apache server while maintaining whatever else you have running on your XAMPP installation. A mirror of this article is located here.
1) Install XAMPP software. This gets you Apache + MySQL all set up in a few clicks. Skip this step if you have both already set up (Drupal needs things like php and mod_rewrite in your Apache build.)
2) Download a copy of your production 'drupal' database to your local MySql server. I suggest using a program like Navicat MySQL since it handles UTF-8 data properly (unfortunately my favorite free MySQL client, SQLyog, seems to lack proper UTF-8 support).
3) Create a user on your local mysql database to match the remote connection settings and give them full permissions:
% mysql> GRANT ALL PRIVILEGES ON drupal.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'drupalpassword' WITH GRANT OPTION; FLUSH PRIVILEGES;
4) Get a copy of the website's PHP files for your Drupal installation (In my case, use a source control system client like Perforce) and copy them to a location you want to do your work in. An example:
C:/p4/atlas-drupal/drupal. I will call this location
%your_drupal_files% from here out.
%your_drupal_files%/sites/default/settings.php and change the base URL to
$base_url = 'http://localhost/drupal'; You should still be able to leave the
$db_url connection setting alone.
%your_xampp_location%\apache\conf\extra\httpd-xampp.conf and add the following lines according to where your copy of drupal lives on your computer:
Alias /drupal "%your_drupal_files%/"
AllowOverride AuthConfig FileInfo
Allow from all
You'll need that "
FileInfo" directive if you are getting 500 errors in your Apache error log like "RewriteEngine not allowed here". You could also add these lines in standard
httpd.confif you are not using XAMPP but just plain Apache.
7) (Skip this step if you are using regular Apache and not XAMPP)
%your_xampp_location%\apache\conf\httpd.conf and uncomment out the line
LoadModule rewrite_module modules/mod_rewrite.so You need this so Drupal can have "clean links".
%your_drupal_files%/.htaccess and change the
9) Restart the Apache service (with the XAMPP control panel if you are using XAMPP)
You now should be able to navigate to your sandbox development copy of the site via