Moving Entire Drupal Site with Databases

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)

  1. 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.
  2. 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.
  3. It would also be a good idea to back up your test database, just in case...
  4. Import the database into your test site.
  5. Download any pictures you've uploaded and any folders that are created by the modules you have installed.
  6. If your live site and test site are not at the same version, you will need to run "update.php."
    • 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.
      • Using Notepad or similar text editor, open "update.php".
      • Near the top, you will see:
        // Enforce access checking?
        $access_check = TRUE;<
      • Change it to FALSE< and save it.
      • Try "update.php" again.
      • If you have any errors listed, search the Drupal site for fixes. There's a good chance that someone else has had the problem. If it appears to be a new error, post a request for help. Take your site out of maintenance mode and plan to start over when it's fixed.
      • Change $access_check< back to TRUE.
    • 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.
  7. 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.
  8. If your current site was installed with Fantastico, delete the current installation. If not, then you have to manually remove all the folders.
  9. 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).
  10. When it is done, I always tell it to email me the installation summary.
  11. If you have any customized themes, non-core modules, or pictures, upload them (FTP) to the correct places on the server.
  12. If there were pictures or module-related folders, upload them now.
  13. When that's done, use phpMyAdmin on your test site and create a back up.
  14. 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.
  15. If you have a customized theme, go to Administer>>Site Configuration>>Themes< and enable it. [Hint: Do not panic if your site looks weird at first. Remember you can always login with< (yes, "user," not your ID.]
  16. If your test and live directories are not identical, you may need to update IMG links, etc.
  17. You should be in business.
  18. 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.