Hi, I have acquired a new site to work on and would like to have a local install running on xampp for testing purposes. Is there a different procedure to install a site locally with an already existing database?
thanks

Comments

dnewkerk’s picture

In your case you won't install Drupal at all in the traditional sense.

First of all you need a "mysqldump" of the database from the live server. The easiest way to get this is to install Backup and Migrate module on the live site and use it to easily download a copy of the database as a single SQL file. If you prefer, you can also export a copy with phpMyAdmin (comes with cPanel and most server control panels), or using the command line: mysqldump -u username -p database_name > backup.sql

Next from the live server, you need to download a full copy of the entire site. The fastest and best way to do this is using the command line or a file manager such as the one that comes with cPanel, in order to create an archive (tar.gz) of the whole public_html directory. If you can't do that, then simply downloading everything through FTP will work (just may take a long time).

Now, in you local server, open up phpMyAdmin, and follow this procedure http://drupal.org/node/81995
Alternately (what I personally do) use the command line for all this, which is much faster.

Then put your copy of the website files in place where they need to be for your local server. If you saved the files in an archive, extract it here. Open the sites/default/settings.php file and adjust the database name and password to match your local server.

Try visiting the address of your local server and hopefully the site will come up. You may need to clear the caches (Administration > Site configuration > Performance).

Hope this helps.

tiki16’s picture

On the settings.php I have login details as follows, but receive an access denied:

$db_url = 'mysql://my-username:my-password@localhost/my-database';

dnewkerk’s picture

Are you using the username and password for your local server, or the live server? You'll need to ensure that you are using the local server's credentials. On MAMP which I use (similar to XAMPP, but for Macs), the default user and password for MySQL is root (both user and password are "root"). I just did a quick Google search and it "appears" that with XAMPP the default user is "root" and there is no password set initially. So you should use this method to set a MySQL password in XAMPP.

If you'd prefer, you can alternately create a new MySQL user and password of your own, and "grant" permission for it to work with your specific database. There's more info if you Google, however this page should get you started http://wiki.phpmyadmin.net/pma/user_management

Hope this helps :)

tiki16’s picture

Strange... my home page loads but none of the links in the nav work. When I enter the full path to a section I still receive
object not found '404 error'
Thanks
Steve

dnewkerk’s picture

Sounds like you may be missing your .htaccess file, which is important for Drupal's URL rewriting to work. Double check that a file called .htaccess exists in your Drupal root folder. This file may be hidden by default in some FTP programs (often there is a preference or menu option to ensure these files are always shown), so you might have missed it when downloading the site (files beginning with a dot are hidden files on unix-like operating systems). If you can't find this file, you can also simply download a new copy of Drupal 6 from drupal.org, extract it, and copy the .htaccess file into place from that.

tiki16’s picture

.htaccess is there? Also not all elements are displaying on the home page. Is it possible that something didn't transfer properly during ftp? I don't recall any errors.

chales’s picture

Did you go to http://example.com/admin/settings/performance and clear your site cache? That's a first step which usually clears up migration related issues.


DrupalVoodoo
tiki16’s picture

It is a locally hosted site on xammp. Cleared the cache in the local DB. I went to http://localhost/my-site/admin/settings/performance and receive a 404 error. None of the links in the nav or elsewhere on the homepage resolve. They are all 404. I have no way of logging in to the site.
thanks

tiki16’s picture

I found the answer on another thread. When exporting the live DB disable clean urls and then import the DB to your local environment, in my case phpmyadmin.
thanks for the help.

dnewkerk’s picture

Since your .htaccess file was present, it seems the issue actually may have been that mod_rewrite may not be enabled by default with XAMPP, which is a feature of Apache which is necessary for clean URLs to work.

Check some of the guides here for info on how to resolve this https://www.google.com/search?q=xampp+enable+mod_rewrite
It's not hard, just involves opening the configuration file, searching for the right line, uncommenting it, and restarting Apache.

Ritvi’s picture

On following the given steps in comment, i came across, my zip file has a folder named www and then the sites file inside them, on opening the setting.php and changing it to , point my local db, the error m am facing is as follow: 

The website encountered an unexpected error. Please try again later.
Drupal\memcache\MemcacheException: No Memcache extension found in Drupal\memcache\DrupalMemcacheFactory->initialize() (line 162 of modules\contrib\memcache\src\DrupalMemcacheFactory.php).

please help