 | Upgrade Instructions Only
This page provides instructions for Upgrading CiviCRM installations on Drupal from version 1.8 to 1.9. If you are installing from scratch - instructions are here. If you are running an earlier version of CiviCRM - you must first upgrade to 1.8 using the instructions here before using these instructions. These steps are tailored for Drupal 5.x. Please make appropriate adjustments for older versions of Drupal.
Before beginning this upgrade, verify that your server is running PHP 5.x. Starting with the 1.9 release, CiviCRM will NOT run on PHP4 servers (more info...). |
 | Upgrade a Copy of Your Site First and Make a Complete Backup
We strongly recommend that you create a copy of your existing site (directories and database) - and upgrade that copy first in order to make sure you can complete the upgrade successfully. In any case, you should create a full backup of the installed civicrm directory tree and civicrm database before beginning the upgrade process. |
Step-by-step Upgrade Procedures
1. Download the v1.9 CiviCRM Package
2. Take the Site Offline (for production site upgrades)
When upgrading a production site, it is recommended that you take your site offline during the upgrade process and log-off your admin user.
*Administer » Site maintenance* (In Drupal 5, this is in "Admin » Site Configuration » Site Maintenance")
3. Backup and then Delete all 1.8 Code Files
CiviCRM will not run properly if 1.8 files are present after the upgrade. Make sure you have a good backup of your complete 1.8 installation and then delete all files and directories from your <drupal_root>/modules/civicrm or <drupal_root>/sites/all/modules/civicrm directory tree.
 |
Be sure that your backup copy of the previous version codebase is NOT located below the <drupal_root>/modules or <drupal_root>/sites/all/modules directory. For example, placing your codebase backup in <drupal_root>/modules/civicrm.bak... will cause errors (Drupal executes any *.module files that are found in the modules or sites/all/modules directory tree). |
4. Unpack the 1.9 Package
Unpack the 1.9 files into the (now empty) <drupal_root>/modules/civicrm or <drupal_root>/sites/all/modules/civicrm directory.
cd <drupal_root>/sites/all/modules
tar -xzf civicrm_download_file.tgz
5. Upgrade your database from 1.8 to 1.9:
 | MySQL 4.0 is Not Supported
Support for MySQL version 4.0 has been discontinued. This means that you may encounter various issues and/or unexpected behavior if you atempt to run CiviCRM under MySQL 4.0 and the CiviCRM engineering team will not provide support for debugging or resolving these issues. You are strongly encouraged to upgrade to the current generally available release of MySQL. |
 | Upgrading From Versions Prior to 1.8
If you are upgrading from 1.6 or earlier versions, you will need to run the database upgrade procedures in sequence. However you do not need to install intermediate codebase versions. Upgrade scripts for prior versions are included in the 1.9 download, and instructions are here. |
Run the Database Upgrade Script
This step is required for ALL upgrades.
Using phpMyAdmin from your browser
- Click on the Import tab for your CiviCRM database.
- Under the Location of the textfile prompt, click Browse and navigate to a local copy of the following file: /civicrm/sql/civicrm_upgradedb_v1.8_v1.9_41.mysql
- Click the Go button below Browse.
- You should see a message indicating that your query has been executed successfully.
Using MySQL from the command-line
shell > cd /var/www/drupal/sites/all/modules/civicrm/sql
shell > mysql -u civicrm_user -h civicrm_db_server -pcivicrm_password civicrm_db < civicrm_upgradedb_v1.8_v1.9_41.mysql
 | Foreign Key Errors Running Upgrade Script
If you are getting foreign key errors when attempting to run the upgrade script, you can try adding the following lines to the script and running it again:
-- add this above the first line
SET FOREIGN_KEY_CHECKS = 0;
.
.
-- add this below the last line
SET FOREIGN_KEY_CHECKS = 1;
|
Dump and Reload Database to Ensure DB Structure is Current
These steps are required ONLY if you are upgrading from a version PRIOR TO 1.7.
- Dump the data ONLY from your upgraded database to a file:
shell > mysqldump -u civicrm_db_username -pcivicrm_db_password -c -e -n -t civicrm_db > dumpFile
- Create a new empty database. We'll call it civicrm18 for this example. You can do this with phpMyAdmin OR from the command line:
shell > mysqladmin -f -u civicrm_user -pcivicrm_password create civicrm18
- Initialize the 1.8 table structure into this new database by sourcing civicrm/sql/civicrm_41.mysql:
shell > mysql -u civicrm_db_username -pcivicrm_db_password civicrm18 < civicrm_41.mysql
- Load your data into the new database by sourcing the dumpFile from step 2:
shell > mysql -u civicrm_db_username -pcivicrm_db_password civicrm18 < dumpFile
6. Verify and Update Configuration Settings File
CiviCRM v1.9 stores most configuration settings in the database. However values needed to load the code and database are stored in the settings file:
<drupal_root>/sites/xxx/civicrm.settings.php.
- Open civicrm.settings.php with your favorite editor and verify or update the following values:
- $civicrm_root : If you are running this installation in a different directory from your 1.8 site, update this setting with the new path.
- CIVICRM_TEMPLATE_COMPILEDIR : If you are running this installation in a different directory from your 1.8 site, update this setting with the new path.
- CIVICRM_UF_BASEURL : If the Drupal URL for this site is different from your 1.8 site, update this setting with the base URL for your Drupal home page.
- CIVICRM_UF_DSN : If this install will be using a different database for Drupal, update this setting.
- CIVICRM_MYSQL_VERSION :
define( 'CIVICRM_MYSQL_VERSION', 4.1 );
- CIVICRM_DSN : This setting must contain the correct information for your upgraded 1.9 database. Unless you have renamed your new 1.9 database to match the name of your old 1.8 database - you will need to change the civicrm_db portion of the setting below. Also review the other values to make sure they are correct for the upgraded database.
define( 'CIVICRM_DSN', 'mysql:
7. Delete all records from Drupal's session table (drupal.sessions)
Using command prompt:
1. shell > mysql -u drupal_user -h drupal_db_server -pdrupal_password drupal_db
2. mysql> use drupal_db; (just to make sure right db is used)
3. mysql> TRUNCATE TABLE sessions;
If you are using phpMyadmin:
1. Click the SQL tab for your Drupal database.
2. Type "TRUNCATE TABLE sessions;" and click Go.
- This step is recommended to prevent session corruption issues.
8. Upgrade AMaViS Version
 | AMaViS Installations Only
This section applies only if you have AMaViS installed.
|
AMaViS needs to be upgraded to handle the new resubscribe functionality (CRM-1799):
9. Reload Drupal Modules and Reset Drupal Menus
- Log in to the upgraded site with your Drupal Administrator login. (If you took the site offline earlier, you'll need to go to http://<yourSiteDrupalRoot>/user to be able to log in again.)
- Go to Administer » Site Building » Modules.
- Make sure CiviCRM is enabled (CiviCRM is listed under "CiviCRM").
- Click Save configuration at the bottom of this form (this lets Drupal find the new location of civicrm.module).
- Go to Administer » Site Building » Menus » Settings.
- Click Save configuration at the bottom of this form (this will rebuild the site menus).
10. Reset Your User Session and Cleanup Template Cache
- Temporarily enable CiviCRM debug features:
- Go to Administer CiviCRM » Global Settings » Debugging
- Set Enable Debugging to Yes and click Save.
- Click the Administer CiviCRM menu (or any other CiviCRM menu item). After the page is loaded, add two additional query string values (sessionReset=2&directoryCleanup=1) to the URL in your browser's location bar, and reload the page. (You may see a large number of missing file warning messages on your screen - depending on how your Drupal Error Reporting option is configured. These are expected and will disappear on the next page request.)
- Now reset Enable Debugging to No and click Save.
 | Do Not Leave Debug Features Enabled for a Public Site Debugging should be disabled for publicly available sites as it may allow browsers to view system configuration information. |
11. Verify and Update Resource URL Settings
If you are running this installation in a different directory from your 1.8 site you will probably need to update the configured CiviCRM Resource URL (Missing icons and images, as well as problems with javascript functions and stylesheets are all symptoms that this setting needs to be updated.)
- Go to Administer CiviCRM » Global Settings » Resource URLs
- Refer to the field help on this screen for instructions.
12. Enable Components
If you plan on using any components that you weren't using in the prior version (e.g. CiviEvent for event management) - you'll need to enable these component(s):
- Go to Administer CiviCRM » Global Settings » Enable Components
13. CiviMail Users - Update Automated Messages and Select Mailing List Groups
This release allows you to provide web-based options for subscribing to and unsubscribing from mailing lists, as well as opting-out of all mailings. It also supports a new resubscribe action (both by sending email or clicking an URL). If you plan on using CiviMail - you will need to manually edit the following Automated Messages to replace obsolete tokens and utilize the new ones.
Navigate to Administer CiviCRM » CiviMail » Headers, Footers, and Automated Messages and suit your automated messages to taste; the following are the new defaults (with the sample tokens):
| Type |
Text version |
HTML version |
| Subscribe |
You have a pending subscription to the {subscribe.group} mailing list. To confirm this subscription, reply to this email or click on this link: {subscribe.url} |
You have a pending subscription to the {subscribe.group} mailing list. To confirm this subscription, reply to this email or click <a href="{subscribe.url}">here</a>. |
| Unsubscribe |
You have been un-subscribed from the following groups: {unsubscribe.group}. You can re-subscribe by mailing {action.resubscribe} or clicking {action.resubscribeUrl} |
You have been un-subscribed from the following groups: {unsubscribe.group}. You can re-subscribe by mailing {action.resubscribe} or clicking <a href="{action.resubscribeUrl}">here</a>. |
| Resubscribe |
You have been re-subscribed to the following groups: {resubscribe.group}. You can un-subscribe by mailing {action.unsubscribe} or clicking {action.unsubscribeUrl} |
You have been re-subscribed to the following groups: {resubscribe.group}. You can un-subscribe by mailing {action.unsubscribe} or clicking <a href="{action.unsubscribeUrl}">here</a>. |
Note: The Resubscribe automated messages may not need to be updated. Compare them to the above.
After you have done this, you will need to select which groups are available to CiviMail. Navigate to CiviCRM » Manage Groups. Click the "settings" link for the group you want to make available to CiviMail. Check the box that says "Mailing List". Save your settings and repeat for each additional group you would like to send mailings. If you do not complete this step, you will not see any groups when you try to send a mailing.
14. Review and Update Access Control Settings
If your site uses CiviMail and you want to take advantage of the new web-based subscribe and unsubscribe pages - you'll need to add the access CiviMail subscribe/unsubscribe pages permission of Drupal "roles" as appropriate for your site:
- Go to Administer » User management » Access control
- Check access CiviMail subscribe/unsubscribe pages for the anonymous user role if you want any contact in your database to be able to subscribe to public "Mailing List" groups from http://<drupal_site>/civicrm/mailing/subscribe?reset=1 AND to unsubscribe by clicking a web-link in your mailings. Alternatively, you can limit access to these features to authenticated users or particular roles.
- It's a good idea to verify other permissions which were added in 1.7 and 1.8 while you're at it:
- access all custom data : You must enable this permission for any role which you want to view or edit custom data fields. EXAMPLE: If your site uses Profile(s) which include custom fields - make sure the role(s) that need to access these Profiles have this permission.
- access Contact Dashboard : You can now provide authenticated users with access to a screen where they can review their subscribed groups, contributions, memberships and event registrations (as applicable). Enable this permission for role(s) for which you want to provide this feature.
- access CiviEvent : If you plan to use CiviEvent, enable this permission for role(s) which will be creating and managing Events and Event Participants.
- register for events : If you plan to use CiviEvent and want to allow online event registration - enable this permission. Be sure to assign this permission for the "anonymous" role if you want to allow un-authenticated visitors to register for events.
15. Put the Site Online (for production site upgrades)
- Toggle the following feature, and put your site back online:
*Administer » Site maintenance* (In Drupal 5, this is in "Admin » Site Configuration » Site Maintenance")
- Review Your Upgraded Site
- Verify that your data is intact.
- Check out the new features and improvements. A summary of the cool new stuff can be found here.
Upgrade Trouble-shooting
Check this section for answers to upgrade problems. If your problem isn't addressed here, check out the Installation and Configuration Trouble-shooting page for additional resources.
A fatal error appears when I try to load a CiviCRM page.
Fatal error: civicrm_initialize() [CRM:function.require]: Failed opening
required 'CRM/Core/Config.php' (include_path='.:/opt/local/lib/php')
in <drupal root>/modules/civicrm/modules/civicrm.module on line 206
This error likely indicates that the new CiviCRM configuration file is not in the expected location or that the $civicrm_root setting is incorrect. See step 3 above.
Foreign Key Errors or Warnings During the Database Upgrade
Foreign keys may have been assigned different names on some installations. Also, different versions of MySQL handle the dropping and adding of constraint checks differently. Try this procedure to reload your data into a new 1.7 database structure if you are having this type of issue with upgrading your database.
Calendar widget doesn't work (throws a Javascript error), and/or CiviMail scripts for open tracking, SOAP authentication, etc. don't function.
If your CiviCRM codebase is NOT located in either <drupal root>/modules/civicrm or <drupal root>/sites/all/modules (i.e. you are using a symlink from there to your codebase) - you will need to create a local file in the top-level directory of your codebase which points to the location of your drupal sites directory.
<?php
define( 'CIVICRM_CONFDIR', '/home/lobo/public_html/drupal/sites' );
?>
Access Forbidden (403) Error After Upgrade
This may be caused by directory permission settings. Make sure your <drupal_root>/files/civicrm directory is set with chmod -R 777 ./*
If you're still getting this error and have clean URLs enabled, try disabling clean URLS (Drupal >> admin >> settings) prior to running the session reset and cleanup (step 8 above). Then re-enable clean URLs.