ARCHIVE: Copy a site to a local XAMPP installation
Here are the steps necessary to get a copy of a Drupal website a 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.
1) Install XAMPP software. This gets you Apache, MySQL and PHP all set up in a few clicks. Skip this step if you have them 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. If your production server has phpMyAdmin you can export your database using it and then import using your local phpMyAdmin. You may also use 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 production Drupal site files and folders (In my case, I 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.
5) Edit %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.
6) Edit %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%/"
<directory "%your_drupal_files%">
AllowOverride FileInfo Limit Options Indexes
Order allow,deny
Allow from all
</directory>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.conf if you are not using XAMPP but just plain Apache.
7) (Skip this step if you are using regular Apache and not XAMPP)
Edit %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".
8) Edit %your_drupal_files%/.htaccess and change the RewriteBase to /drupal.
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 http://localhost/drupal

Here are some issues I ran
Here are some issues I ran into on a windows based XAMPP install and I'm documenting them here to hopefully save someone else the trouble.
-- To restore a large DB, you can use the command line by going to the C:\xampp\mysql\bin folder in a command prompt. Use the command "mysql --user root DATABASENAME < EXPORTFILE.SQL". This will restore the data to the local database. This works much faster than phpadmin or a gui.
-- If you put the drupal folder in the root of the directory, you will not need the directions above in step 6 or step 8.
-- I had to make the changes in step 7 even though I was using XAMPP to get clean urls to work.
Make sure you are working locally and not on your live server before you do anything rash...like drop tables. ;)
Good luck.
Tips for very large SQL files
mysql -f --user root new_drupal_database < huge-file.sql-fprevents the import from stopping on errorsimproved version
I'm working on an improved version of this article here:
http://satellite.esn.org/wiki/index.php?title=Back-up
when it will be ready, I will merge the two articles
Works beautifully!
I did my research; XAMPP seems to be very widely used and is being very actively supported by it's developers. Yes, it is probably more difficult to install and configure than WAMP or some others, but I felt the stability and support were worth it. I combined the instructions in this tutorial and the Improved version posted at http://satellite.esn.org/wiki/index.php?title=Back-up to install on a Vista Business Edition 32 bit laptop. No problems, no noticeable effect on my laptop's performance.
Thanks!
Only Front Page is showing
Problem:
Only Front Page is showing (correctly).
When I click on a link - which is a cleanurl it redirects me to the xampp local homepage (http://127.0.0.1/)
Followed all the steps above and also had a look at
http://drupal.org/node/43545
http://drupal.org/node/145832
BTW thanks to mikeytown2 for the mysql tip... had a massive database to import and that helped.
When I looked at the
C:\xamppinstalationfolder\apache\logs
It said:
127.0.0.1 - - [07/Jul/2009:13:32:43 +1000] "GET /drupalsite/content/cleanurl HTTP/1.1" 302 -
Does that mean its giving a 302 error? What am I doing wrong?
marcopolo ---
Blog Marco | Best Designed Drupal Websites
hi marcopolo, I had same your
hi marcopolo, I had same your problem. I copied a site (localhost) to other computer, it just show like front page, and all cleanurl are redirected to xampp homepage.
I found cause. because I didn't turn on mod_rewrite.
(open file httpd.conf in folder "..\xampp\apache\conf", find "mod_rewrite" and uncomment this row, save file, restart apache)