This guide will describe how to upgrade your Drupal installation to a new minor version. For example when you want to upgrade from version 6.05 to version 6.12.
For a major version upgrade (e.g: from 6.xx to 7.xx), please refer to Drupal’s upgrade instructions that are related to the new version that you are about to upgrade.
Please note that this guide is for Drupal versions 5 or later.
Step 1: Backup!
This step is very important: you must fully backup your Drupal installation, as there is a chance that it will become corrupted during the upgrade process.
How to backup your Drupal installation directory
On hosted environments, you can download the entire directory to your PC via FTP.
On dedicated servers and on some shared hosting that provide SSH access, you can make a copy of the Drupal directory to another location of the disk.
After this, you will need to backup your Drupal database as well by:
- Exporting the database content to a file.
On shared hosting environments, this can be done by using the hosting control panel (or PHPMyAdmin) to export the contents to a file.
On dedicated server, you can use the database’s own export utility to backup the database contents to a file.
- Saving the file on your PC
Download the database backup file and store it locally on your PC’s disk.
Step 2: Download latest minor version of Drupal
Go to Drupal’s main site and download the latest minor version of Drupal:
If you have Drupal 5.xx, download the latest 5.xx version.
If you have Drupal 6.xx, download the latest 5.xx version ,etc.
Upload the file into a new directory in your web site.
For example, if your Drupal is installed on /html directory, create a new directory called /html/drupal_new, and upload the latest version of Drupal that you just downloaded in step 2, into this directory.
Now, you need to extract the contents of the Drupal archive either by using the command line (in Linux/Unix with SSH):
tar xzf drupal-x.xx.tar.gz
or by using the hosting control panel.
Once you extracted the file, you can continue to Step 3.
Step 3: Copy files from old Drupal to new Drupal
Copy the following files from your old Drupal installation directory to the new Drupal directory that you created in step 2:
- .htaccess (if you made any changes to it)
- robots.txt (if you made any changes to it)
- /sites directory (which includes site configuration, modules, themes that you installed, and the data files for each site).
Some of the files or directories such as sites may already exist in the new installation directory – you can overwrite them.
Step 4: Run the update.php script
In order to finish the update process, you need to run Drupal’s update script by pointing your browser to the update.php script in the newly installed Drupal directory. For example :
Where drupal_new is the name of the directory you created and installed the new Drupal version (see step 2 above).
You have to be logged in to Drupal as site admin before running this script.
If you can’t login to Drupal as site admin, don’t worry, there is a way to bypass this:
Simply edit settings.php file that should be under sites/default/ or sites/<your site name> directory, and change the line that says:
$update_free_access = TRUE;
$update_free_access = FALSE;
Point the browser to update.php, and then make sure you change this line back to:
$update_free_access = TRUE;
Check out the update.php script output for errors.
At this point you should have the newer version running
Step 5: Test
Test your new Drupal version by pointing the browser at the new version’s installation directory, for example:
Check that everything works.
- You may need to clear Drupal’s cache if you have it turned on. Go to Admin->Performance and clear the cache.
- If you get errors like:
warning: array_map() [function.array-map]: Argument #2 should be an array in system.module
You may need to re-activate the current theme in the Administration->Build Site->Themes page.
If everything is OK, continue to step 6.
Step 6: Switch between new and old installation directories
Now you need to switch between the older Drupal installation directory to the new Drupal installation directory, so when accessing the site, you will get the new version of Drupal.
If you would like to comment or add your suggestions, please use the comments form below.
If you liked this article, please share it on Digg, Stumble Upon or del.icio.us. Thank you.