Dashboard > CiviCRM Documentation > ... > Installation Archives > Upgrading Drupal Sites from v1.7 to v1.8
Upgrading Drupal Sites from v1.7 to v1.8 Log In | Sign Up   View a printable version of the current page.

 Contents
  Documentation Home
Upgrade Instructions Only

This page provides instructions for Upgrading CiviCRM installations on Drupal from version 1.7 to 1.8. If you are installing from scratch - instructions are here. If you are running an earlier version of CiviCRM - you must first upgrade to 1.7 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.

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.8 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*

3. Backup and then Delete all 1.7 Code Files

CiviCRM will not run properly if 1.7 files are present after the upgrade. Make sure you have a good backup of your complete 1.7 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.8 Package

Unpack the 1.8 files into the (now empty) <drupal_root>/modules/civicrm or <drupal_root>/sites/all/modules/civicrm directory.

// Modify this line to use your real drupal root
cd <drupal_root>/sites/all/modules
// Modify this line with the actual downloaded package file name
tar -xzf civicrm_download_file.tgz

5. Upgrade your database from 1.7 to 1.8:

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.7

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.8 download, and instructions are here.

Run the Database Upgrade Script

This step is required for ALL upgrades.

  • Load and run the SQL upgrade script: civicrm/sql/civicrm_upgradedb_v1.7_v1.8_41.mysql
    • You can do this via phpMyAdmin, OR from the command line:
      // Move to the civicrm/sql sub-directory
      // Replace /var/www/drupal/modules/ with the location of your CiviCRM codebase
      shell > cd /var/www/drupal/modules/civicrm/sql
      
      // Note that there is no space between the -p and the civicrm_password
      shell > mysql -u civicrm_user -h civicrm_db_server -pcivicrm_password civicrm_db < civicrm_upgradedb_v1.7_v1.8_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:
    // from the civicrm/sql directory
    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:
    // from the civicrm/sql directory
    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:
    // from the civicrm/sql directory
    shell > mysql -u civicrm_db_username -pcivicrm_db_password civicrm18 < dumpFile

6. Verify and Update Configuration Settings File

CiviCRM v1.8 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.7 site, update this setting with the new path.
    • CIVICRM_TEMPLATE_COMPILEDIR : If you are running this installation in a different directory from your 1.7 site, update this setting with the new path.
    • CIVICRM_UF_BASEURL : If the Drupal URL for this site is different from your 1.7 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 :
      // Enter closest dot release to your installed version. 4.1, 5.0 are all valid examples.
      // Do NOT enter minor revision (second dot) - 4.1.2 is NOT a valid value for this setting.
      define( 'CIVICRM_MYSQL_VERSION', 4.1 );
    • CIVICRM_DSN : This setting must contain the correct information for your new 1.8 database. Unless you have renamed your new 1.8 database to match the name of your old 1.7 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 new database.
      define( 'CIVICRM_DSN', 'mysql://crm_db_username:crm_db_password@db_server/civicrm_db?new_link=true');

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. Select "Drupal" database.
2. Select "sessions" table;
2. Type "TRUNCATE TABLE sessions;" where you fire your queries. Else click on "Truncate".
  • This step is recommended to prevent session corruption issues.

8. 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).

9. 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.)
    // Example URL
    http://...../?q=civicrm/admin&sessionReset=2&directoryCleanup=1
    
    // Example with Clean URLs
    http://...../civicrm/admin?sessionReset=2&directoryCleanup=1
  • 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.

10. Verify and Update Resource URL Settings

If you are running this installation in a different directory from your 1.7 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.

11. 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*

12. Payment Processor and Contribution / Event Registration Setup

This Step is Required for Sites Using Online Contribution Pages, Membership Signup or Event Registration

The method for storing Payment Processor configurations has changed in this version. If you are using CiviContribute to collect online contributions OR membership signup and/or using CiviEvent for online event registration - you must follow the steps in this section.

  • Re-enter your Payment Processor information:
    • Login with administer CiviCRM permission
    • Go to *Administer CiviCRM » Global Settings » Payment Processors* (the page will say that "There are no Payment Processors entered.")
    • Click add one
    • Select the Payment Processor Type corresponding to the one you have been using in 1.7 (e.g. PayPal - Website Payments Pro)
    • Enter the required account information for your selected processor (e.g. User Name, Password, etc.). As of 1.8 ALL processor configuration information is entered from this screen. You no longer need to enter or edit payment processor passwords, signature values etc. in civicrm.settings.php.
    • Click Save
  • Link your re-entered Payment Processor to each of your existing Online Contribution and Event Registration pages
    • Go to *Administer CiviCRM » Manage Contribution Pages*
    • Click Configure
    • Click Title and Settings
    • Your newly entered Payment Processor should be selected in the Payment Processor field
    • Click Save (This is important - the link between the contribution page and the payment processor is not created until you hit Save on this screen.)
    • Repeat these above steps for each active Online Contribution page on your site...
    • Go to *Administer CiviCRM » Manage Events*
    • Click Configure
    • Click Event Fees
    • Your newly entered Payment Processor should be selected in the Payment Processor field
    • Click Save (This is important - the link between the registration page and the payment processor is not created until you hit Save on this screen.)
    • Repeat these above steps for each active Event Registration page on your site...

13. Review and Update Access Control Settings

Several new permissions were added in the 1.7 release. If you are upgrading to 1.8 from 1.6 or an earlier version, you should review your access control settings for each Drupal "role" and adjust as needed for your site:

  • Go to *Administer » User management » Access control*
    • 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.

14. 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.
    Additional Locations and Mailing Labels
    The number of locations/addresses shown on the contact editing screen is now controlled from Global Settings » Address Settings. The default value after upgrading is 1. If you want 2 or more locations to available when adding new contacts - you'll need to modify the Number of Locations value.

    If you use the Mailing Labels function - you'll probably need to add the {contact_name} token as the first line in the label formatting field at Administer CiviCRM » Global Settings » Address Settings (including the contact name in labels is optional in 1.8 - and is not done automatically).

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.

// Create a new file - settings_location.php
// Enter the following code (substitute the actual location of your
// <drupal root>/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.


Added by David Greenberg , last edited by David Greenberg on Apr 15, 2008  (view change)
Labels: 
(None)

Recently Updated  |  Documentation Credits

Powered by a free Atlassian Confluence Open Source Project License granted to CiviCRM . Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators