Upgrading old Drupal, Part 1: No content shown, unable to login, missing modules, and resolve it.

I was upgrading an old drupal 6 multi-site to drupal 7. The main (default) site has been upgraded for years, all other sub-sites had been disabled or moved out before the migration.
But I recently want to re-enable a long-ignored old sub-site, which takes me a while. I got no content shown, unable to login, missing modules.

And This is How To Resolve Them.

The first Durpal 6 site was installed on Ubuntu 10.04 with apt, upgrade with Ubuntu 12.04, 14.04, and now 16.04 with Drupal 7.
So the situation and environment changes are:

  • Ubuntu Linux version upgrade
    • No Problem
  • MySQL version upgrade
    • No Problem
    • Database upgrade automatically and smoothly
    • Database name and user account / password remain the same.
  • PHP version upgrade to PHP7
    • No Problem
  • Drupal version upgrade
    • Problems
    • Themes not compatible
    • Modules not compatible

Here's how I make it done.

1. Fix path and enable virtualhost

Remeber that your Drupal installation folder path became /usr/share/drupal7 from /usr/share/drupal6
I'm a Lighttpd fan, so edit your site config file. For example /etc/lighttpd/conf-available/11-drupal-subsite.conf
Change

server.document-root    = "/usr/share/drupal6"

To

server.document-root    = "/usr/share/drupal7"

And enable the virtualhost

sudo lighty-enable-mod drupal-subsite
sudo service lighttpd restart

Now you'll see your site, but with error, no content shown and not able to login.

2. Update Modules

Go to /etc/drupal/7/sites/all/modules/, make a backup, then start searching for the 7.x version of all your modules. Replace your existing ones with 7.x version.
Remember to select Core compatibility to 7.x, or use This Link.
Avoid modules with This project is not covered by Drupal’s security advisory policy. warnings or Maintenance status: Unsupported and Development status: Obsolute .

If you can't find suitable one, that's destiny you need to forget about it. Farewell my loved module.

3. Update Themes

Go to /etc/drupal/7/sites/all/themes/, make a backup, then start searching for the 7.x version of all your themes. Replace your existing ones with 7.x version.
Remember to select Core compatibility to 7.x and Stability: Has a supported release, or use This Link Avoid themes with This project is not covered by Drupal’s security advisory policy. warnings or Maintenance status: Unsupported and Development status: Obsolute .

If you can't find suitable one, that's destiny you need to forget about it. Farewell my loved theme.

4. Fix paths stored in Database

Yes Drupal stores module paths in Database, which means you need to modify them record by record.
I prefer another way: make a DB Dump, modify it, and restore.

You can use command line (cli) tools or phpmyadmin. sudo apt install phpmyadmin

You can find the username and password in dbconfig.php in case you the original one has been forgotten. It's been a long time, isn't it? ;-) cat /etc/drupal/7/sites/YOUR_DOMAIN_NAME/dbconfig.php Login phpmyadmin, dump (export) your database into a .sql backup file. Open an UTF-8 supported text editor or use sed to find all drupal6 and replace with drupal7. Save it in another name.
Drop all tables in current database (don't drop the database itself) and restore (import) with your modified .sql file.

5. Run update.php

You might not be able to login yet, so we're going to enable free access for update.php temporary. Edit you /etc/drupal/7/sites/YOU_DOMAIN_NAME/settings.php and append this setting: $update_free_access = TRUE; Now go to http://YOU_DOMAIN_NAME/update.php, follow the instructions.

If you got problems in update.php process, check my Upgrading old Drupal, Part 2: Show module names which causes Drupal update failed, and resolve it.

5. Login and enjoy!

Login with http://YOU_DOMAIN_NAME/user/login or http://YOU_DOMAIN_NAME/?q=user/login
Your loved site should be now ready for you.

6. Cleanup

Oh, please remember to remove $update_free_access = TRUE; from your /etc/drupal/7/sites/YOU_DOMAIN_NAME/settings.php, and remove phpmyadmin with this command: sudo apt remove phpmyadmin --purge

Hope this HOWTO can save a tree and a kitten.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.