| Drupal

Changing from Drupal 6 to Drupal 7 is not just a simple update. The steps seem straightforward, but there are major changes in the way Drupal 7 works and stores data. So a move up across major version numbers is really a "migration" as opposed to a simple update or patch.

If your site is fairly simple, with good backups, and you use the right approach, you can accomplish the migration without too much trouble.

The more complex your site is, the more complex the migration will be.

Doing a migration involves several steps. You might want to review these related tutorials.

Step 1: Backup your site's database


* It is wise to try an update or upgrade on a test copy of your site before applying it to your live site. Even minor updates can cause your site's behavior to change.

There is a handy tool called Backup and Migrate, which helps simplify the backup process, which you can download from this page http://drupal.org/project/backup_migrate. Note: it only works with MySQL, and is still under development. You should also do a manual backup of your database using phpMyAdmin. We show you how to do this in this tutorial.

Step 2: Backup all your folders and files

You have several ways to do this, and you might want to do it more than one way for safety

  1. You can download all the files to your local computer
  2. Copy the files to another directory on your server
  3. Use the backup facility that is probably built into your hosting control panel

You can't be too paranoid about having extra copies.

Step 3: Double check to make sure you can complete the upgrade

Check on the Drupal 7 status of your contributed and custom modules and themes.

Step 4: Check for the latest version of Drupal 6.x


You can't skip versions when you upgrade. For instance you cant go from 6.0 to 6.2 in one step. You also can't upgrade directly from 6.0 or 6.1 to Drupal 7. You have to have your Drupal 6 installation at the latest level.

How do I know which version of Drupal I'm running?

  • Go to Administer (or Administration) >> Reports >> Status report.
  • You will see your version number if you have Drupal 6.0 or later. In Drupal 5.x and earlier, the path to go to is Administer >> Logs >> Status report.

Where do I get the latest version of Drupal 6? http://drupal.org/project/drupal

Step 5: Take the site off-line


Go to Administer >> Site configuration >> Site maintenance.


Select "Off-line" and save the configuration.

Step 6: Change the theme to Garland


Go to Administer >> Site building >>Themes


Click the check box to enable the theme, and the radio button to make it the default. Scroll to the bottom of the page and save changes.

You need to use the basic theme. If you are using a template, check with the designer to see if there is an updated version, and you can do that upgrade after the site is working with Garland.

Step 7: Disable all non-core modules


Go to Administer >> Site building >> Modules.


You can expand the categories by clicking on the category name and see what is enabled. If you added an additional modules to your site, there will be additional categories. Expand them and uncheck the boxes next to the modules

Step 8: Clear all optional module check boxes


It is possible that some modules cannot be immediately disabled, because others depend on them. Repeat this step until all non-core modules are disabled and all check boxes are clear. Be sure to scroll to the bottom of the page and save the changes.

Step 9: Remove unwanted modules


If you know that you will not re-enable some modules for Drupal 7.x and you no longer need their data, then you can uninstall them under the Uninstall tab after disabling them. The Uninstall tab is at the top of the modules page.

Step 10: Remove sites/default/default.settings.php


On the command line or in your FTP client, remove the file /sites/default/default.settings.php

Step 11: Delete all your other folders and files except /sites/


Empty your Drupal files directory except for:

  • /sites/
  • any custom files you added elsewhere.

If you made modifications to files like .htaccess or robots.txt, you will need to record those changes and re-apply them after the new files are in place.

Step 12: Remove unwanted module folders


If you are abandoning any modules because they are not compatible with Drupal 7, remove them from the directory

Step 13: Download and extract Drupal 7


Download Drupal 7 if you haven't already. http://drupal.org/project/drupal

You can extract the files on the server and copy them to your main directory. Alternately you could extract them on your local computer and use FTP to move them to your sever.

Don't worry about overwriting the files in the sites folder. Only the files that need replacing will be replaced.

Step 14: Reapply any changes to your .htaccess file or robots.txt files


Re-apply any modifications to files such as .htaccess or robots.txt. Use a text editor to make changes.

Step 15: Make your settings file writable


Make your settings.php file writable, so that the update process can convert it to the format of Drupal 7.x. settings.php is usually located in sites/default/settings.php

Normally this would best be set at 444, but it needs to be writable so 644 or 666 if you are having trouble will be the correct setting. BE SURE YOU REMEMBER TO COME BACK AND RESTORE THIS SETTING AFTER YOU ARE FINISHED with the migration.

Step 16: Run update.php


Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your domain name). This will update the core database tables. Click continue and follow the steps.

 If you can't access update.php make a change to your settings file:

If you are unable to access update.php do the following:

- Open settings.php with a text editor.

- Find the line that says:
$update_free_access = FALSE;

- Change it into:
$update_free_access = TRUE;

- Once the upgrade is done, $update_free_access must be reverted to FALSE.

Step 17: Backup your new database


Using the same procedure you used before, make another database backup. Save it with a different name or to a different location than your original backup. You may still need that one.

Step 18: Upgrade your modules to their newer versions.

You've gone through the core upgrade, but now each module has to be upgraded. Then you can update and re-enable your non-core modules by following these steps:

  1. Check your notes, and the UPGRADE.txt files inside each module, to see if any special upgrade instructions apply
  2. Fully remove the old module directory inside sites/all/modules/ (if you haven't already)
  3. Download, unpack and move the new module directory to sites/all/modules/
  4. Enable the module
  5. Run update.php again (you should have run it once already when upgrading core) and check for any message output.
  6. Back up your database and files again, between each module update, so that if there is a problem, you can revert to the most recent update.

If you have errors when you run the update.php script:

  1. Note any error messages you see.
  2. Restore your site to its previous state, using the file and database backups you created before you started the upgrade or update process. Do not attempt to do further updates or upgrades on a site that had update problems.

Step 19: Upload your Drupal 7 compatible theme


Make sure everything works in the Garland theme before you switch over to your Drupal 7 theme.

Step 20: Go to Reports and run a Status report


16. Go to Administration >> Reports >> Status report. Verify that everything is working as expected.

Step 21: Set update_free_access is set to false


Ensure that $update_free_access is FALSE in settings.php.

  • Go to Administration >> Configuration >> Development >> Maintenance mode.
  • Disable the "Put site into maintenance mode" check box and save.

Scroll to the bottom of the page to save the configuration.

That should be the last step in your successful migration from Drupal 6 to Drupal 7.

Related Tutorials:

Planning for a Drupal 6 to Drupal 7 Migration

How To Put Drupal 7 In Maintenance Mode.

Migrating Drupal 6 CCK Data To Drupal 7 Fields