Community Documentation

Upgrade process

Last updated May 1, 2013. Created by bekasu on September 6, 2009.
Edited by Navid, awasson, jcisio, kbrinner. Log in to edit this page.

Note: DO NOT run install.php at any time during an upgrade. It will empty your content from the database.

Upgrade Steps

  1. Update Drupal core, modules and themes to the latest Drupal 6 versions. (Follow best practices here. As usual, you should back up your site and database prior to doing this.)
  2. Backup your existing site and database.
  3. Log in as user ID 1 (the site maintenance user).
    This is the user name that you created during the installation process for your site.
  4. Put your site in maintenance mode
    Go to the site maintenance page (Administer > Site configuration > Site maintenance or http://www.example.com/admin/settings/site-maintenance). Select "Off-line" and save the configuration. If you have defined a custom maintenance theme in your settings.php file, comment it out before proceeding.
  5. Change all themes to Garland
    Go to the Themes page (Administer > Site building > Themes or http://www.example.com/admin/build/themes). Enable "Garland" and select it as the default theme. If you have been using a separate theme for administration, select "Garland" for your administration theme as well. You can find the administration theme setting at (Administer > Site configuration > Administration Theme or http://www.example.com/admin/settings/admin). If you are using a custom maintenance theme, comment out 'maintenance_theme' => 'your theme name' in settings.php.
  6. Disable non-core modules
    Go to the Modules page (Administer > Site building > Modules or http://www.example.com/admin/build/modules). Disable all modules that are not listed under "Core - required" or "Core - optional". It is possible that some modules cannot be disabled, because others depend on them. Repeat this step until all non-core modules are disabled.

    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.

    You can also use Drush to disable all non-core modules (first save a list of all enabled modules):

    drush pml --no-core --type=module --status=enabled --pipe > modules.txt
    xargs -a modules.txt drush -y dis
    xargs -a modules.txt drush -y en
  7. Remove default settings file
    On the command line or in your FTP client, remove the file sites/default/default.settings.php
  8. Remove all old core files and directories
    Remove all old core files and directories, except for the 'sites' directory and any custom files you added elsewhere. If you made modifications to files like .htaccess or robots.txt, you will need to re-apply them from your backup, after the new files are in place.
  9. Remove uninstalled modules
    If you uninstalled any modules, remove them from the sites/all/modules and other sites/*/modules directories. Leave other modules in place, even though they are incompatible with Drupal 7.x.
  10. Download Drupal 7
    Download the latest Drupal 7.x release to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.

    On a typical Unix/Linux command line, use the following commands to download
    and extract:

    wget http://drupal.org/files/projects/drupal-x.y.tar.gz

    tar -zxvf drupal-x.y.tar.gz

    This creates a new directory drupal-x.y/ containing all Drupal files and directories. Copy the files into your Drupal installation directory:

    cp -R drupal-x.y/* drupal-x.y/.htaccess /path/to/your/installation

    If you do not have command line access to your server, download the archive using your web browser, extract it, and then use an FTP client to upload the files to your web root.

  11. Re-apply modifications to core files
    Re-apply any modifications to files such as .htaccess or robots.txt.
  12. Make your settings.php file writeable
    Make your settings.php file writeable, 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
  13. Run the update script
    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.

    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.
  14. Backup your database
    Backup your database after the core upgrade has run.
  15. Upgrade fields
    If you were using CCK (and perhaps additional modules) to create fields for your content types, you will need to upgrade the data in those fields as a separate step. Download the Drupal 7 CCK module, and turn on Content Migration. Go to Structure > Migrate Fields or http://example/com/admin/structure/content_migrate for a page to walk you through the migration process. There are now several types of fields in core, but not every type. You might need to download Drupal 7 versions of contributed modules to support other types of fields (such as the References module for nodereference fields and/or userreference fields). Learn more about migrating content from CCK to Core Fields.
  16. Update contrib modules and themes
    Replace and update your non-core modules and themes, following the procedures at http://drupal.org/node/948216
  17. Check the Status Report
    Go to the Status Report page (Administration > Reports > Status or http://www.example.com/admin/reports/status). Verify that everything is working as expected.
  18. Make sure settings.php is secure
    Ensure that $update_free_access is FALSE in settings.php.
    Remove write permissions.
  19. Check Drupal Core Modules
    Make sure that standard modules from a typical fresh install are engaged. Some modules that may not be engaged are: 'Dashboard', 'Contextual Links', 'Overlay', 'Field', 'File', 'Image' and 'Shortcut'.
  20. Remove your site from Maintenance Mode
    Go to the Maintenance Mode page (Administration > Configuration > Development > Maintenance or http://www.example.com/admin/config/development/maintenance). Disable the "Put site into maintenance mode" checkbox and save the configuration.

Comments

UPGRADE YOUR 6.X SITE TO the MOST RECENT LEVEL B4!!

I went through the process above, but my site was at an older version of 6.0. Nowhere does it state (as far as I could see) I must be on the most recent version of 6.x before I can upgrade. I followed the steps, uploaded 7.X files, updated db and it hosed my site. FML.

Getting the following error:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mobiles_job.blocked_ips' doesn't exist: SELECT 1 FROM {blocked_ips} WHERE ip = :ip; Array ( [:ip] => x.x.x.x) in drupal_is_denied() (line 1635 of /home2/mobiles/public_html/includes/bootstrap.inc).

Yes it does say to do this, 2

Yes it does say to do this, 2 pages back in this book http://drupal.org/node/550152

Edit update.php

I had the same error while running the update script, but opening the settings.php-file, doing the changes described in step 12 ($update_free_access = TRUE;) and rerunning update.php solved the problem.

upgrade from drupal6 to 7

7. Remove all old core files and directories, except for the 'sites' directory and any custom files you added elsewhere. If you made modifications to files like .htaccess or robots.txt, you will need to re-apply them from your backup, after the new files are in place.

Step 7, are we deleting all directories in the root drupal directory and remaining with only with "sites" directory?

Yes, after making a backup

Yes, after making a backup (or two). You'd have a backup before you start, then the post-update backup, and of course, you are doing all of this first on a copy of your site.

Step 7 - yes remove all old

Step 7 - yes remove all old files except for the 'sites' directory.
then you bring in the core files from Drupal 7, and continue with the upgrade process.
You don't need the old core D6 files or directories and you are replacing with the new D7 files and directories

E Ismail
econpost.com

Clear your browser cache before running update.php!

This should be added to the instructions.

Clear your browser cache before running update.php!

If your browser still has an open session with your D6 site when you run update.php, it will throw an error. This also corrupts your database, making it impossible to upgrade to D7 without first restoring your database from a backup.

The error will look something like:

DatabaseSchemaObjectExistsException: Cannot add index <em class="placeholder">system_list</em> to table <em class="placeholder">system</em>: index already exists. in DatabaseSchema_mysql->addIndex() ( ...

"There is nothing, absolutely nothing, half so worth doing as simply messing around in boats!"
Grasmash.com - Drupal Tech Blog

So did emptying cache work?

So when you emptied your cache then your upgrade worked?

digibrill tic

So did emptying cache work?

So when you emptied your cache then your upgrade worked?

digibrill tic

Upgrade to 7

Just simply sucks if you have any contributed models.

Error in upgradation

Displaying the following error in upgradation:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'seoabcin_seoabc.blocked_ips' doesn't exist: SELECT 1 FROM {blocked_ips} WHERE ip = :ip; Array ( [:ip] => 127.0.0.1 ) in drupal_is_denied() (line 1779 of C:\wampz\www\seoabc\includes\bootstrap.inc).

Please help

odd error in contrib module during core upgrade

I got this error during my core upgrade:

nodeaccess_nodereference_check_cross_access() in
sites/all/modules/nodeaccess_nodereference/nodeaccess_nodereference.install on line 132

Yes, a contrib module. It was disabled beforehand - I checked the system table after the error to confirm that.

What I found was that I already had the D7 version of the contrib modules in sites/all/modules (from a test upgrade I did earlier), and for some reason, it tried to access that file despite being from a disabled module. So I emptied sites/all/modules and reran update.php and no more errors. The site seems to be working and I'm wondering whether I should rerun from the backup. I've got a quarter million nodes so doing so is not so quick.

But the lesson is do not have D7 version of contrib modules in sites/all/modules, even if they are disabled.

similar experience

I had a similar experience although what I tried was removing all of the D6 contrib modules before running the upgrade - see the thread I started in the forums at: http://drupal.org/node/1678070

ImageStyles after upgrade

Hello, i cannot find any threads on the issue so I'll ask here at the upgrade steps.
Basically, after upgrading the site everything works great however the imagestyles does not show the thumbnail during node creation. The thumbnail is generated and appears in folders, however it won't show on the page until a refresh. Not just the edit page, any image style that needs to be generated requires a page refresh for image to show up. I have other drupal 7 sites on same server, and image style works as expected - without issues.

for imagecache presets to

for imagecache presets to image styles migration, check this
http://drupal.org/node/1316472#comment-5430882

I think

  1. step 7 should include "record your Drupal site's database access credentials in settings.php" before users are instructed to delete the file.
  2. step 12 should include some mention about how to restore db settings in a new settings.php file or something. Right now, it's as if update.php will prompt for new db settings and create it, which it will not.

--
..happiness is point and click..
http://www.bronius.com

Another way to disable non-core modules using drush

The drush method in step 6 did not work for me but this did:

drush pm-disable `drush pm-list --no-core --type=module --pipe`

Credit goes to: http://blog.joshnotes.com/how-to-disable-all-contributed-modules-on-drup...

My experience of upgrade

Just some hints how I did it - may be it helps somebody. Dont blame me, if it doesnt work for you. Drupals ways are sometimes...well...unknown...and mostly the problems are between display and chair.

Background: I am not expert, but I have used Drupal starting from version 4 in my websites (biggest one is Pulmad.ee).

First things first:
1. Follow the upgrade instructions, but they dont work all the times.
2. If you have prefixed your database, remove prefixes - dont ask why. Had the same database with prefixes and without and upgrade works better without prefixes.
3. Change your DB engine to MyISAM or to InnoDB ie dont let it be mixed.
4. If you change it to InnoDB, then remember NOT to delete DB tables directly from MySQL directories, it makes you cry later (InnoDB keeps tables in cache or something and when you delete DB and try to reinstall DRUPAL you will get errors like "table exists etc". Always DROP tables.
5. Make backups. Make lots of them :D

Modules to remove completely (there are definitely more, but those are the ones I had to remove). I cant tell you why there are errors, my task was to get upgrade running without errors.

Secure pages (just a precaution)
Userpoints (upgrade errors)
Location (upgrade errors)
Voting API (upgrade error)
Node Gallery (upgrade errors)
Statistics (upgrade errors, also its the one of the biggest tables)
Search (its the biggest, also its the one of the biggest tables and can cause AJAX and PHP errors)
Truncate cached and sessions before upgrade.

And most important:

When doing update on optional core modules - DONT DISABLE THEM :D (yes, it is also written in upgrade documents). This is, as far as I can see from different forum posts, most common mistake people (and me of course) do. I think, it should be highlighted in upgrade documents with huge letters and painted in red.

Regards,

Virgo
Pulmad.ee
Helitehnikarent.ee

Script problems when installing a new Drupal 7 Theme

Dear Sir/Madam,

I am planning to install a nice design theme Designmd01 - Responsive Drupal 7" from themeforest webpage.
My web portfolio is http://www.mattcreations.com

Just come across that has some script problems when I do the upgrade for my website.

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'expire' in 'field list': SELECT expire, value FROM {semaphore} WHERE name = :name; Array [:name] => variable_init in lock_may_be_available line 167 of /home/mattscom/public_html/includes/lock.inc.

Uncaught exception thrown in shutdown function.

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'value' in 'where clause': DELETE FROM {semaphore} WHERE value = :db_condition_placeholder_0 ; Array [:db_condition_placeholder_0] => 377660395184e535493769.99858540 in lock_release_all line 269 of /home/mattscom/public_html/includes/lock.inc.

It would be much appreciated if you can teach me how to solve these problems.

Thanks very much,
Matthew

Do NOT update your site in CHROME!

If you attempt to upgrade your site using Chrome you'll run into the dreaded "An AJAX HTTP request terminated abnormally" bug, and will have to start over. Be smart and use another browser.