Start with Moving entire Drupal site with databases
This might help too: Backing Up Your Database
I know the "official" process is to load the "tar" file to the host and unpack it. As an alternative, one can copy the code directly from your test site on your PC. I've tried uploading code from my machine twice with disastrous effects. (Okay, so I was born blonde!) So, I've worked out my own process that works. [By the way, this also reduces the bandwidth usage for those who might be running short on that.]
What has always worked for me is to install Drupal with cPanel/Fantastico (I know there are some people out here who will speak ill of Fantastico, but it has always done me right). Now, to be fair, one needs to understand what Fantastico can and cannot do.
Fantastico only supports core functions. It does not support custom themes, contributed modules, or custom code (outside of content). Fantastico does not use "update.php" (as a matter of fact, doesn't even load it), so it is not a good idea to use it to upgrade your installation. As long as you understand this, you're much less likely to have problems.
Make sure that the correct versions of modules and themes are working on your test site.
Here's my process: (by the way, this should pretty much work for changing hosts as well)
- Keep a pencil and paper handy to write down what changes you have to make. You can use this if you need to restart, or to think about changes to your site that slow down moving to new releases.
- Use phpMyAdmin (on some hosts, it's hidden under MySql) to back up your live database. If you have a site that is actively receiving new content, you may have to put the site into maintenance mode to prevent losing new content.
- It would also be a good idea to back up your test database, just in case...
- Import the database into your test site.
- Download any pictures you've uploaded and any folders that are created by the modules you have installed.
- If your live site and test site are not at the same version, you will need to run "update.php."
Okay, now it's time to do the damage. For me, the rest of this takes less than 15 minutes, so the outage to your users is minimal.
If your current site was installed with Fantastico, delete the current installation. If not, then you have to manually remove all the folders.
Now tell Fantastico to install the current version. Leave the directory field blank to put it in your "root" directory (probably "public_html"). The userid and password you supply will be your "super user" (user/1).
When it is done, I always tell it to email me the installation summary.
If you have any customized themes, non-core modules, or pictures, upload them (FTP) to the correct places on the server.
If there were pictures or module-related folders, upload them now.
When that's done, use phpMyAdmin on your test site and create a back up.
Then go to your cPanel again and invoke phpMyAdmin. When you get there, select your Drupal database and then "Import." There's a section to locate the back up on your local computer (Browse). Find it, and then Click on the "Go" button.
If you have a customized theme, go to
- Open your browser to your test site. Don't panic if everything looks strange, or even blank.
- In the URL bar, append "update.php" and press Enter. If it says you don't have the access rights, don't worry.
- If you had a custom theme, you probably need to re-enable it for the site to look right.
- Now check out all your module settings. They'll probably be okay.
- Look through your content, especially the front page. Make sure your menus are correct.
- Check out any content that uses custom code, especially if you are changing Drupal versions.
- Does everything check out? Good, you've done all the real work. Now the easy(er) part.
Administer>>Site Configuration>>Themes and enable it. [Hint: Do not panic if your site looks weird at first. Remember you can always login with
http://www.mywebsite.com/?q=user (yes, "user," not your ID.]
If your test and live directories are not identical, you may need to update IMG links, etc.
You should be in business.
One more little bit of business if you used Fantastico: go to the main Drupal directory on your PC and copy (FTP) the
update.php script to your server. I don't know why they leave it out, other than they don't use it. You may need it later.