Drupal 6 to 7 upgrade process tricks

I've been working on a Drupal 6.x to 7.x upgrade and thought I'd share some of my process and tricks. There are a few helpful tips & tricks to get around issues you may experience during the core Drupal 6 to 7 upgrade process that I'll outline here. Bear in mind that these tips and tricks are for upgrading Drupal 6 to 7 core. I have not attempted to upgrade contrib modules yet. I've prepped my entire site for the process with a focus here on upgrading core Drupal first. Then we'll come back and upgrade the contrib modules next. Also this assumes of course that you have not hacked any core Drupal 6 files. If you have hacked core, you'll need to make backups of those tweaked files so you can re-apply your hacks later once you've upgraded your site to D7.

Preparation

The first thing you should do before attempting any Drupal 6.x to 7.x upgrade is backup your entire site and the database. Also make sure you're working in a localhost (non-production) environment. NEVER ATTEMPT AN UPGRADE ON A PROD SITE WITHOUT MAKING BACKUPS OF THE SITE AND DB FIRST. Store these backups in your local environment so you can easily get to them and restore your site if something goes wrong with the upgrade. So make sure to have a good backup of your entire Drupal 6.x site and its database, and make sure you're trying the upgrade in a local dev environment.


Now here are the upgrade steps outlined in detail:

Upgrade Steps

1) Make sure you've upgraded your Drupal core to the latest 6.x version (at the time of this writing it's 6.26.


2) Make sure you've upgraded all of your contrib modules to their latest 6.x versions.


3) Confirm your 6.x site is in good working shape by visiting the site status report - make sure you have no available updates and that you're not generating any other errors or warnings on your status report page.


4) Disable all your 6.x contributed and/or custom modules (all non-core modules). Don't disable core 6.x modules. Just disable the contribs and the custom modules.


5) Enable a core theme as your main site theme and administration theme - I enabled Garland. Disable any contrib or custom theme. This is important as any custom theme would cause potential errors during the upgrade. So make sure to enable GARLAND or another core theme.


6) Place your site in maintenance mode.


7) Make sure you know what your user/1 (super user admin) password is. When you try to run the update.php script the update process will most likely log you out of the site. So make sure you can log back in easily by recalling this password.


8) As mentioned above make sure you have backed up your site files and db.

Now what I do to run the upgrade process to 7.x is first make a copy of my 6.x site at this point in my /htdocs or root folder. So I should have a new folder that contains a copy of my site files. This way I can easily just revert back to the 6.x site original files if necessary.


9) In the copied folder remove all the core 6.x files. LEAVE YOUR Drupal 6 /SITES directory in place. But remove all other core 6.x files.


10) Now download Drupal 7 and extract all of its core files and folders into your copied D6 folder location. DO NOT REPLACE THE /SITES folder. The /SITES folder should remain your D6 version.

The /sites folder in #11 contains your Drupal 6 settings.php file. This is fine. It's pointing to your existing D6 db and that's the db we'll be upgrading. The Drupal 7 update.php will convert and upgrade your D6 settings.php file into the correct D7 mode.

Helpful Tips/Tricks

11) TIP/TRICK #1: MAKE SURE TO MAKE YOUR SETTINGS.PHP file writable - check the permissions on it and make sure everyone can write to it during the upgrade process (on your local).


12) TIP/TRICK #2: Confirm that the settings.php file has the $update_free_access set to TRUE. By default this will be set to FALSE, but recall that the upgrade process will log you out of the site. In order to run update.php as an anonymous user you'll need to have access to the update.php script so make sure this is set to TRUE during the upgrade process.


13) TIP/TRICK #3: This is very important and I've seen it causing many issues with the upgrade process via issue queue posts on drupal.org. MAKE SURE YOU CLEAR YOUR BROWSER CACHE before attempting the update.php script in your browser. I actually closed down all my browsers; restarted Firefox; cleared the browser cache; restarted it again and then proceeded. You need to make sure to do this in order to clear any browser sessions especially if you've also loaded the 6.x version of your site and it's talking to the same db.

Run Update.php to perform upgrade

14) Now, once you've completed all 14 steps above you're ready to run update.php. Point your browser to your site URL and append the /update.php path. Run update.php and the update process should start. Follow the steps and buttons that the update process gives you.


Congratulations! You should now have an upgraded D6 site to Drupal 7.14. If you run your status report you'll see reminders to set the $update_free_access back to FALSE; and also to set the appropriate permissions on the settings.php file. Do this and then your status report should be in the green.


Remember that the instructions above are for upgrading Drupal core. I have not explained the process for upgrading the contrib modules yet. That will be done in a separate post. Also you may want to refer to the great upgrade instructions on drupal.org here: http://drupal.org/node/570162. These instructions outline the overall D6 to D7 upgrade process for core. Also note that there's a lot of issue queue activity on this subject of core D6 to D7 upgrade issues. One that I've found helpful is here (along with a comment I made outlining my process per above): http://drupal.org/node/1008352#comment-5991456.


Good luck and Drupal on!