Moving Drupal
Submitted by learnbythedrop on Mon, 05/19/2008 - 20:30
Ear Drops #3
In this drop I talk through the steps required to move your Drupal site from one domain to another.
The Steps
- Take your site offline.
- Download the entire site to a local directory.
- Export the site database to a local directory.
- Create a new MySQL database if necessary
- Edit sites/default/settings.php if moving to new database.
- Upload site files to new domain. Don't forget .htaccess.
- Login and test.
- Bring site back online.
Your comments and feedback are welcome.
- learnbythedrop's blog
- 3191 reads




Comments
Hi Rob,
I followed those steps one by one, is just that i have a different situation, i have a server with a web page, this web page is html basic... it is all in the httpdocs folder. So for testing pourposes i created a folder called drupal test... so it looks like this> www.website.com/drupaltest
So i uploaded the files over there, then restored my database, then changed the settings file.
But when i type the address into the web browser it rises the 404 error.
My question is, what did i missed? is it that i need to create a subdomain to point to the new address?
thanks
The times when I've seen 404 messages there have been problems with the .htaccess file which is in the root Drupal directory. Check the web server side to see if the .htaccess file is there. You may have to check an option in your FTP utility to "show hidden files" in order to see it. One of the problems is that by default some FTP editors hide that file.
If you check your web server folder and the .htaccess file is not there then you should locate it on your localhost and upload it. It's possible that your local machine was hiding it as well, in which case you will need to unhide it in order to upload. On Windows for example to unhide files while in the directory you would choose Tools => Folder Options => View => Show Hidden Files and Folders.
Hi,I am also having problems on the installation process on the domain, i followed your steps but i get "thi link is broken" and the google logo next to it. Any idea?
thanks
If you're getting a message saying that the link is broken then I suggest that you check first to make sure that the files you uploaded are to the correct location on your server.
I've been testing my site in many ways and sometimes it appears "drupal - this site iss offline" and depending on what i write on settings.php it changes to "this link is broken". I think i wrote the right thing on settings.php (username:password/host/databasename), I might give the hosting a call to check this though...
Thanks for showing me a light at the end of the tunel, : )
Rob,
I have done these steps in order to download my website to my computer so that I can play with it on localhost.
ftp all files to my c:/drive
edited my setting.php file
created new database
imported data via bigdump (too big for phpmyadmin)
downloaded all extra modules and put in sites/all.
run update.php
At this point when I go to test drive the site I only see the primary links, no theme, no blocks and the login is not working.
Any suggestions. Big newbie here.
Thanks
The first thing I would do is check to see if everything is in the right place. Contrib themes should be in /sites/all/themes and contrib modules should be in sites/all/modules. You may have done that already but it's always worth it to double check. Also check to see that you have the .htaccess locally on your hard drive in the root of the Drupal directory. Sometimes that file is hidden in FTP programs and doesn't get downloaded.
Thanks for the tutorial. The problem I am having is with moving a large database. I am moving the site from a live Linux host to a local Windows / XAMPP environment. Phpmyadmin cannot handle the 39Mb sql dump file. Command line approaches are not an option because Cygwin does not have MySQL support. I have tried a script bigdump.php and it is also failing.
I know I can clear my cache tables on the live site with Phpmyadmin, but I see that as a last resort. I don't want to wreck my live site without having a functional way to restore it.
Any ideas?
I solved my problem. This may be useful for others out there. I first exported my live site database by unchecking "Data" in Phpmyadmin and exported the database. I then imported that database locally, structure only. Then on the live site I checked "Data" in Phpmyadmin, then deselected any table named "cache" or starting with "cache_" and exported the database. The .sql file was much smaller. I then imported that file locally and the site is working, error free and in the exact same state it was in on the server.
There may be a better way to do a remote Linux web server --> local Windows XAMPP large database transfer, but I'm just happy I finally got it to work.
Man,
I follow the steps in this web :http://drupal.org/node/120630, but I get very big file. Therefore, I cannot manage to import dabase to my localhost phpmyadmin. The maximum large that allow is only 2,048 KB.
Even I try to compress the database to format gzipped, I could only get 3,800KB.
I want to do the same thing like you, but I did not see any any name start with "cache" in phpmyadmin.
For infomation: I would like to transfer from remote Linux web server --> local Windows Wampserver.
Is there any other way? Please guide me. Thank you.
Does one need to install all the modules first before getting the old database ported over? I mean to say, if the new Drupal install doesnt have all the modules from the old site, will the tables that those modules call up get corrupted or cause Drupal as a whole to be confused?
Drupal needs the "core" modules and tables to function at a basic level. The contributed modules are not necessarily needed but you will lose all of the functionality that those modules had added so your site may not be usable if you're relying on those contributed modules. The data from the contributed modules will still be in the database but they shouldn't become corrupted since you can't write any data to them without the modules being present.
My main question would be this. Why would you move the site without moving the contributed modules?
To clarify, I do intend to install the modules on the other side. Thats not in question. I just simply was trying to determine the Order of Operations in doing so. I didnt know if I needed to either:
a) Perform the fresh drupal install, install all the non-core modules that were on the live site, and THEN import the db.
OR
b) Create sql database, import the database, do a fresh Drupal install and point it to this new database, THEN install the non-core modules.
I think it's important to define what "install" means with respect to Drupal. On the one hand we have files located on a web server somewhere. On the other hand we have a database waiting to be populated. What the install process does is connect the files to the database and create the appropriate tables. When you're moving you're site you've already performed the install so you shouldn't have to do that again.
You take your local files and upload them to a webserver. If the files aren't local then you're just moving them to a new location. Then you create an empty database on your webserver. You export your local database tables for Drupal and import those tables to your new database. So now you've got the right pieces in place you just need to connect the files to the database.
Your settings.php file contains the information that points your Drupal files to your database. So you edit the settings.php to point to the right database. If you're database hasn't moved then you shouldn't have to edit your settings.php file.
Exactly what I was saying, yes. I just wanted to make sure I didnt go out of order. Basically the site is already live but Im re-enacting a copy here on my localhost (LAMP) I did not have any Drupal sites installed on localhost before I started on this project, but as you say, I know that a clean install is always best anyway.
Thanks!
After posting my previous reply I read the question again and I thought my first answer really wasn't too clear. So here's some clarification.
You don't need to "reinstall" any modules that were installed before you moved the site. The database that you will export and import to the new location knows what's installed. So when you make that move you will fill an empty space (the new database)with the tables from the database that you are moving. Then you will move all the files from the original site to the new location and point your settings to the new location of the database.
So you're not really installing Drupal again. You're just moving what you have from one location to another.
I installed Drupal 6 and am a new user. I am going through lesson five and from what I have read and learned on the Lesson 5 video, Drupal comes standard with "Page", "Blog", and "Story" content types. I installed the correct version of Drupal 6 but I only have "blog" and "forum". What am I doing wrong? Do I need to install a module?
You shouldn't have a forum content type unless you have enabled the forum module. Forum is a core module (comes with the standard install) but is not enabled by default. The page content type should also be there without any additional modules. If you haven't been doing any configuration or editing content types then this situation would be very curious to me.
You have a couple of options. You can restore a backup (if you have one) and see if the "page" content type reappears. Or you can use the core features to add a new content (/admin/content/types/add type), call it what you like and give it the attributes of a page. The main difference on a page type is that you might not want to enable comments and you might not want to have it promoted to the front page when you create it.
Thanks for your response. Would you mind walking me through what the attributes of a "page" are so I can setup the page. I am trying to create some static content. Thanks.
Hi!
First thanks for all your tutorials, those have been very helpful to me.
I followed your instructions on transfering the site, edited the settings.php import the database, uploaded all files and I am getting this:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7a Phusion_Passenger/2.1.3 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at imodelcasting.com Port 80
So I really don't know how to fix this. What is your point of view? thanks
First, I would check to see if the .htaccess file has been transferred over. Sometimes the file is hidden and doesn't get transferred because of that. A missing .htaccess file will cause problems. Second I would check the server configuration. Have you run a Drupal site on this server before? How you handle it depends on whether it's your own server or a shared hosting account. If it's a shared hosting account then check with your host's support to see if there are any issues with Drupal. If it's your own server then it's likely that you know more about the configuration of Apache and PHP.
Post new comment