Drupal 6 to 7 migration not just a simple upgrade, it involves several steps and the process may vary for each site. This may increase in complexity for more complex websites. This tutorial will instruct you the steps that are to be followed one after another in order to upgrade a Drupal 6 website to Drupal 7.

 

Before upgrading your website to Drupal 7, make sure that all contributed modules used in your website are available for Drupal 7. You have to rewrite any custom modules from your Drupal 6 site.

 

Step 1: Backup your website:

This is the first and most important step of the upgrade process. In this, you got to backup your database first.

  • Open phpmyadmin of your server,

PhpMyAdmin

  • Select the database of your website from the left sidebar.
  • Look for an option ‘export’ at the top and click it.

Database Export

  • Now select ‘quick ’ and click go

Backup DB

After that, your database should start downloading.

  1. Then, backup all your folders and files. You can do this either by compressing and downloading all the folders of your website or use the backup feature (if available) of your hosting control panel.

 

Step 2: Verify the version of your Drupal 6 website

  1. Updates get released for Drupal 6 every now and then. So, it is important to upgrade to the latest version in Drupal 6 before upgrading to Drupal 7.
  2. You can check the current version of your Drupal 6 site by navigating to the ‘status report’ (Administer > Reports > Status Report)

Drupal 6 version

 

  1. Download the latest version of Drupal 6 here http://drupal.org/project/drupal

 

Step 3: Put the site in maintenance mode

  1. It is better to ensure that nobody uses the site while it’s being upgraded. The site just shows a ‘site under maintenance’ page to the other users while administrator can continue to work on the website.
  2. Navigate to Administer > Site configuration > Site maintenance and select the option ‘Off-line’ and save the configuration.

Maintenance mode           Maintenance Mode

 

Step 4: Change the theme to garland

  1. Go to Administer > Site Building > Themes and set garland as the site’s default theme.
  2. We can change the theme back to the current theme after migration if every component of the garland theme works perfectly.
  3. The administration theme can either be garland or seven according to your ease of use.

Theme Selection

Theme change

 

Step 5: Disable all modules except the core ones

  1. Navigate to Administer > Site Building > Modules and uncheck all the modules but the ones under the sections ‘core-optional’ and ‘core-required’.

Disable Modules

  1. Some modules cannot be disabled in a single step. They will become available for disabling after you save the configuration. Repeat this until all non-core modules are disabled.

 

Step 6: Uninstall useless modules

  1. Uninstall the modules that you think you will not need anymore in Drupal 7.
  2. Go to the ‘uninstall’ tab on the top of the page and check the modules and their data which you do not want to migrate.
  3. Scroll to the end of the page and click the uninstall button.

Uninstall Modules

 

Step 7: Remove all folders except sites

  1. First, remove the settings.php file from your /sites/default folder.
  2. Then, from your hosting control panel, select all the folders except the sites folder and delete
  3. Remove all the module folders inside the /sites/all/modules folder.

 

Step 8 : Download and extract Drupal 7

  1. Download the latest version of Drupal 7 from http://drupal.org/project/drupal
  2. Extract the archive in your server.
  3. Copy all the folders into your website’s folder (only if you had extracted it in some other folder)
  4. Replace any files that are in the sites folder (if it prompts you to do so).

 

Step 9: Rewrite previous changes (if any) to .htaccess file

  1. Right click on the .htaccess or robots.txt file and select edit from your hosting control panel.
  2. Rewrite the .htaccess or robots.txt files if you had any custom changes in Drupal 6.

 

Step 10: Change permissions for the settings.php file

  1. The settings.php file will be write protected by default. The installer will need to write it while the installation process starts.
  2. It is necessary to make sure that the settings.php file has enough permissions for the installer to modify it.
  3. Change the permission of the settings.php file into 644 or 666.

 

Step 11: Run update.php

  1. Now, run the update.php. You can do this by typing the url in your browser as http://yourdrupalsite.com/update.php

Run Update.php

  1. Ensure that the ‘$update_free_access’ is set to TRUE in the settings.php file.
  2. Read the instructions before clicking the ‘continue’ button.
  3. If everything is good, click the continue button and you’ll see the progress bar of the update process.
  4. Backup the new database if the update process was successful and returned no errors.
  5. If it returns an error, try to find the source of the error, fix it and then re-run update.php

Run Update.php

 

Step 12: Update your modules

  1. Download the modules one by one and extract them into your sites/all/modules folder and run update.php each time.
  2. Check your notes, and the UPGRADE.txt files inside each module, to see if any special upgrade instructions apply.
  3. Fully remove the old module directory inside sites/all/modules/ (if you haven’t done already)
  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. Backup 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 there was an error,

  1. Note down the error message and revert back to previous state by importing the most recent database that we backed up.
  2. Update other modules and finally update the modules that gave out error messages. This should help solve the problem to some extent.
  3. Check each modules’ .info file (for views module it would be views.info inside /sites/all/modules/views) for any dependency. Download and extract all the dependent modules with views (the module which you are going to update at the moment) to avoid any dependency errors as drupal modules are dependent on one other.

 

Step 13: Change the theme

  1. Download and extract a theme of your choice for your website into the /sites/all/themes folder
  2. Go to Administer > Appearance and change the theme to your prefered one.
  3. One important note is to ensure that everything works perfect in the garland theme before changing to your prefered theme.

 

Step 14: Change permissions of settings.php

  1. Be sure to make the settings.php file unwritable.
  2. Change the permissions of settings.php to 444.
  3. Do not forget to change the ‘$update_free_access’ in the settings.php to

 

Step 15: Put the site back online

  1. If everything is just fine, go ahead and put your site online by navigating to Administration > Configuration > Development > Maintenance mode.