Hello there,

I'm trying to get the whole Drupal site I have in the server to localhost, so I can work on the new version with all the contents and everything already done (since it's easier to see how the new theme and modules will work). The problem is, I can't just copy the database at localhost and make everything work properly.

I'm working on a Mac, using MAMP for the server. I have the backup of the site (all drupal files), and I have exported the database. The problem is, when I put both things together, because then the front page works -except for the CSS, the style is totally missing- but I have no access to any other. It doesn't recognize the users and I can't log-in. Therefore, I can't do anything.

I have also tried to install the site from scratch and then upload the database tables, but then as soon as I tr it replyes that "access table already exists".

How can I just transfer my whole site to localhost?

Thank you!

Comments

dman’s picture

first log in like this, even if the theme is broken.
Then visit the admin/build/theme page, and there's a chance that the theme will magically auto-correct. I'm guessing that the path to the theme (and possibly the modules) got mixed up a bit and needed re-scanning to locate the new location.

dresde’s picture

Thanks for the idea, but I still can't log in. It may have something to do with it since it finds the pages going through the "unclean" url, but when I try to log in it doesn't recognice it, it nevers get logged.

Any other idea?

Road Runner’s picture

I run Mac 10.6 and MAMP oon my MacBook Pro and do what you are trying all the time. While I have run into the usual gotchas I have been able to make this work. My troubles usually are in the transfer of database.
This is the way I usually do it.
Mamp has new version - just got it yesterday.

1. Do fresh Drupal install in the htdocs folder in mamp you now have www.localhost:8888/drupal up and running
2. Now duplicate everything from the server site that resides in public_html folder and move it to your drupal folder on your Mac. A lot of this you won't need but get it all to be safe. Pay attention to the settings.php file you'll have to change the database pointer inside that file to point to your database that fresh drupal install is using. I use textwrangler for that stuff.
a. just so you know you just overwrote your new drupal folders and files with the stuff from your server. If you don't want to do this don't copy the drupal stuff except for sites folder - which you will need. I think there are 11 files.
3. Now using the module migrate and backup save a copy of your database on your server - use the backup function. Download this to your Mac with this module too.
4. Using PHPMyAdmin on your Mac drop the current database your fresh Drupal install is accessing. This leaves you with no tables. Then using import function in PHPMyAdmin import from the database you downloaded into the now empty database.
5. I think I usually run update at this point directly before accessing site www.localhost:8888/update.php

As I recall I have run into blank screens etc but I usually just do the usual trial and error and things work. I think the above is how I have come to make it all work now.

Hope that gets you thru it.

dresde’s picture

I'm trying it, I'll let you know. Thank you very much for the complete process!

dresde’s picture

I was able to follow your path up to the update script, but now I get:

DrupalDrupal
Site off-line

The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.

I checked the settings.php file and seems OK, but I cannot go to any site.

dresde’s picture

Ok, so I re-did it and it's kind of working, but not really. I have access to the administration pages, but those where the template should work are missing plnty of stuff, not only the CSS but also the contents. I get this message in front-page, where it reads "Page not found"

* warning: array_map() [function.array-map]: Argument #2 should be an array in /Applications/MAMP/htdocs/drupal/modules/system/system.module on line 1015.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /Applications/MAMP/htdocs/drupal/includes/theme.inc on line 1771.
* warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/drupal/includes/theme.inc on line 1771.

dresde’s picture

So, it's almost done know. I just have a problem linking the database. I have everything in its place, but wehn I visit my site in local i get the

Site off-line

The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.

If you are the maintainer of this site, please check your database settings in the settings.php file and ensure that your hosting provider's database server is running. For more help, see the handbook, or contact your hosting provider.

With all the drupal background and everything. But I can't find what's the problem with the database, since settings is correctly configured (I think..)

Road Runner’s picture

When you moved the site from the server at public_html did you move the Drupal files and folders too. If so don't and use the Drupal from your fresh install. If you didn't then try it the other way.
I know I have run into the thing you're describing and pushed my way thru it by trial and error. Sorry I can't remember exact details.

You could also try now that you have a semi working thing. To unbundle a new Drupal and move those eleven files and folders into your local site then run update.php. I would try this first.

dman’s picture

The error message you are looking at is most likely the best clue.
Did you follow the instructions or watch the video?
Are you REALLY sure that the settings are correct?
Are you sure that the MySQL does not use a custom port? MAMP probably has to if you have an active native installation of MySQL on the machine also.
Are you sure you are using the right socket? When I installed a different version of PHP from the Apple distribution, the mysql_sock path was different.

dresde’s picture

mmm, lots of info, thanks. I just used the instructions in http://drupal.org/node/232460, and it still doesn't work. Also, i don't have any php.htacess file in the drupal folder.

Seriously, I don't get what is going on. I have followed several ways to do do this and I'm still unable to make it work. I'm afraid if I'm ever able to do it, I'm going to ahve the exact same probles when trying to upload it again to the server, so I think I may just put the site pffline for a weekend, work on the huge changes there and then keep making small changes for some time.

grawat’s picture

I think I have encountered the problem u have mentioned above (was while I was moving my sites between servers) and usually it was a permissions issue. Since, ur moving ur files to ur pc u could change the permission of all files to 777. Also, check if u have moved the .htaccess file.

kfrank’s picture

I'm having the same problem. Did you figure this out?

honorfield’s picture

I have access to my homepage, but if i go to another page on my site i always get the error message:
"The requested URL /example/example/ was not found on this server."

Here what i did step by step:

1. Download the entire Drupal folder (in my case "httpdocs") to get sure that i get the invisible ".htaccess" file as well.
2. Export the database in "PHPMyAdmin" without changing any of the default export-settings.
3. Change the database-settings in "settings.php" which is located in "your_drupal_installation/sites/default". Here i change the username, password and address for the database. Example: $db_url = 'pgsql://username:password@localhost/databasename';
4. Open "PHPMyAdmin" on my local machine, create a new database under the same name as the one that i just downloaded and import it here.
5. Now i open the localhost in my browser (MAMP is running) and can access my page.

It is working, but as i said, i can't see more than just my homepage. Another funny thing happens when i klick "home" on my Drupal site,
i end up in the root directory one level above my drupal installation folder.
And when i type "update.php" and go through the process i get the message:

Drupal database update
warning: reset() [function.reset]: Passed variable is not an array or object in /Users/appleuser/Sites/cms/drupal/update.php on line 314.
warning: array_pop() [function.array-pop]: The argument should be an array in /Users/appleuser/Sites/cms/drupal/update.php on line 314.
The update process was aborted prematurely while running update # in .module. All errors have been logged. You may need to check the watchdog database table manually.

I just can't believe how complicated it is to move a Drupal installation from one place to another! I was sitting on this now for so long and
it really gets annoying. Please help, i'm desperate!

honorfield

jaypan’s picture

To move sites between servers, I do the following:

1) install the backup and migrate module
2) backup the database using this module
3) copy all files from the whole site to the new server (in this case your local machine)
4) delete settings.php from the files on the new server
5) copy default.settings.php, and rename the copied file to settings.php
6) access the new site, and install it as if it were a fresh Drupal install
6B) You can use whatever site name and account names (etc.) you want when installing
7) After installation, enable the backup and migrate module
8) use this module to reinstall the database backup you took on the original server

This works every time for me, and takes care of any file paths etc with no errors.

Contact me to contract me for D7 -> D10/11 migrations.

honorfield’s picture

Thank you for the detailed description! I did exactly as you said, but as soon as i move away from the backup module site after step 8 i still get the same error message as before:

404
Not Found
The requested URL /mypage/taxonomy/term/62 was not found on this server.
Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2 Server at localhost Port 80

The only place i can go is the homepage. I also tried update.php but it doesn't make any difference. And to give a read and write permission to all folders and sub folders doesn't help eater. If i run my other drupal site which i only installed on the local host than there is no problem.
I just don't understand enough about php and databases to figure out were the problem could be. Is it because i have the page in offline-mode when i update, or does it have to do with the acquia-drupal module that tries to connect to the server and causes confusion somehow? Well, i don't think so, but i just don't know were to look next.
Please, if you have any suggestions!
honorfield

andyf’s picture

I'm gonna be a bit rude and pipe in without reading through the whole thread - it sounds to me like apache's rewrite rules aren't working. I think apache's trying to serve the page mypage/taxonomy/term/6 from the filing system rather than giving it to Drupal's index.php with ?q=mypage/taxonomy/term/6.

To have apache pick up on the .htaccess file you need to adjust its config file. I'm not an apache guru but I think the appropriate directive is AllowOverride. More info: here

dman’s picture

Yes, this is what happens if you move from a host that has clean-URLs to one that doesn't support them - without following the instructions or testing beforehand.
You need to establish that Drupals core requirements checklist are met on the target host before uploading a site over top of it.

Troubleshooting solutions documented here
This issue is different from the one reported in the OP.

honorfield’s picture

To all of you - thank you, thank you, thank you!!!
You guys are legends!
My local site is now up and running.

batuka’s picture

Why not tell us how you did it?

jaypan’s picture

The instructions are right there further up this thread where I listed them.

Contact me to contract me for D7 -> D10/11 migrations.

beau7’s picture

I am hoping the person who gave these instructions are still around. Please to assist. I have backed up the database using the backup and migrate module. I have downloaded drupal 10 to install it on the local site. I have downloaded the public_html file from the remote site to add to the new site. 

I just want to know where exactly am i to put the public_html file? Anywhere in the htdocs or somewhere in the new installed drupal file? Please let me know. I am new to drupal. Also I do not see any default.settings.php document in the xammp/htdocs/public_html/site/default area. There was only settings.php.  What is the work around this? 

THe site is drupal 7 and I want to update it to drupal 10 on the localhost before i upload it on the remote host. Please to help and thanks.