Skip to end of metadata
Go to start of metadata


Documentation Search


CiviCRM 4.1 Documentation

Developer Resources


CiviCRM books!

Make sure to check out our Online User/Administrator and Developer Guides! You can also support this project by ordering a hard copy.

Or support us by buying an eBook or hard copy of Using CiviCRM from Packt Publishing.

Use this document to UPGRADE CiviCRM installations on Drupal to the latest 4.1 release from version 2.2.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x or earlier 4.1 version.
Version 4.1 Requirements

Before beginning this upgrade, verify that your server meets the requirements for CiviCRM 4.1.

  • CiviCRM 2.2.x+ : You must be running CiviCRM version 2.2.x or higher to use this upgrade. Running a version prior to 2.2? First upgrade to 2.2 using these instructions
  • Drupal 6.x : CiviCRM 4.1 has been built to run under Drupal 6 and is not compatible with Drupal 5.
  • PHP 5.2.x  or 5.3.x :  CiviCRM will NOT run on PHP4 servers. (more info...).
  • MySQL 5.0.x or higher with InnoDB support : CiviCRM is compatible the current generally available MySQL release. Note that MySQL 5.1 is recommended for new installations and for sites during upgrades as CiviCRM is beginning to use Triggers more (eg to support multi-lingual installations), which require SUPER privileges in MySQL 5.0.
  • PCRE with Unicode properties support (more info).
Please modify civicrm.settings.php

Do the following at step 7, as detailed below, and not before. Locate your civicrm.settings.php file. It will be usually in <drupal home>/sites/default/ . Open the civicrm.settings.php and make following change

Table of Contents
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.
If you are upgrading a COPY of your production site - make sure the site you are about to upgrade is a fully functioning installation before you begin the upgrade process. (more info...)

All Cron Jobs Must Be Re-configured

System Administrators: All CiviCRM-related cron jobs will stop working as soon as any site is upgraded to 4.1. Cron jobs will need to be reconfigured using the new Scheduled Jobs method.

Step-by-step Upgrade Procedures

1. Download the most recent CiviCRM Package

  • From http://sourceforge.net/project/showfiles.php?group_id=177914
  • Select the currently available civicrm-4.1 tarball for Drupal 6. Example: civicrm-4.1-drupal6.tar.gz*
    Note: Read the above carefully.  There is a special "drupal6" tarball of CiviCRM 4.1 for Drupal 6 - you need this version!  If you install the regular "drupal" download then CiviCRM will be disabled after upgrading.

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.
Administer » Site Configuration » Site Maintenance

3. Ensure that CiviCRM is not your Drupal homepage

Due to changes in Dashboard files from 3.0 to 3.1, you need to ensure that your Drupal homepage is not the CiviCRM homepage. If your site does use CiviCRM as its front page, change it by clicking on:
Administer » Site Configuration » Site Information
Then ensure that the "Default front page" value is not civicrm (change it to node if necessary). If you made a change, click Save configuration

NB: there are a variety of modules that may affect the Drupal homepage. Consult the appropriate module's documentation if you are using them to set the homepage to civicrm for the administrative action required to change to a different non-CiviCRM homepage for the upgrade process.

4. Disable all CiviCRM integration / extension modules (NOT CiviCRM itself)

If you have modules installed in your Drupal site that integrate with or extend CiviCRM functionality, you should disable them prior to running the upgrade script. This will prevent modules that are not compatible with the new version from triggering errors in the upgrade process.

Administer » Site Building » Modules

Note which modules in the CiviCRM section of the modules listing are currently enabled (taking a screenshot is one easy way to do this). Now un-check the Enabled box for ALL modules in the CiviCRM section of the modules listing EXCEPT for CiviCRM itself. Click Save.

Do NOT disable CiviCRM itself. Only disable other modules in the CiviCRM section of the modules page. The upgrade will NOT run if CiviCRM is disabled.

5. Backup your CiviCRM database

Refer to the MySQL reference manual or the phpMyAdmin documentation if you need information on backing up your database.

6. Backup and then delete all previous version code files

CiviCRM will not run properly if files from previous version are present after the upgrade. Make sure you have a good backup of your complete previous version installation and then delete /sites/all/modules/civicrm. It may also be necessary to remove some of the files from your <site home>/files/civicrm/ directory.

Be sure that your backup copy of the previous version codebase is NOT located below the <drupal home>/modules or <drupal home>/sites/all/modules directory. For example, placing your codebase backup in <drupal home>/modules/civicrm.bak... will cause errors (Drupal executes any *.module files that are found in the modules or sites/all/modules directory tree).

Make sure you have logged in to Drupal BEFORE deleting the old files. Do not log out until the entire process is complete.

7. Unpack the latest package and verify permissions

  • Unpack the files into <drupal home>/sites/all/modules/.

  • You should now have a new civicrm directory tree under the <drupal home>/sites/all/modules/ directory.
  • Ensure that your Drupal filesdirectory is writeable by the webserver. You can use the following command to set proper permissions:

  • Locate your civicrm.settings.php file. It will be usually in <drupal home>/sites/default/
    Open the civicrm.settings.php and make following change

8. Run the Upgrade script

This step is required for ALL upgrades.

MySQL 4.0 and 4.1 are Not Supported

Support for MySQL versions 4.0 and 4.1 has been discontinued. This means that you may encounter various issues and/or unexpected behavior if you attempt to run CiviCRM under these versions, 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.

* Point your web browser to the following URL (you should already be logged in to Drupal with administrator-level permissions):

  • *- If "clean URLs" are enabled

    *- If "clean URLs" are NOT enabled

  • You should see the Upgrade screen.
  • Should you encounter an error reading: "Version information missing in civicrm database", try running a query like this: 'UPDATE civicrm_domain SET version = '2.2.9' WHERE id = 1;'
  • If you are ready to upgrade, click the Upgrade Now button.
  • You should see the message Upgrade successfulwhen the upgrade completes.
    • If you receive any errors during the process, please note down the exact error message, and check for solutions on the community support forum.
  • Now click the Return to CiviCRM home page link. This will rebuild CiviCRM menus automatically and return you to the CiviCRM home dashboard. You should the message Menu has been rebuilt.

9. Verify and Update Resource URL Settings

If you are running this installation in a different directory from your previous version you may 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 » Configure » Global Settings » Resource URLs
  • Refer to the field help on that screen for instructions.

Note: if your site uses https, you must have Force Secure URLs enabled at <example.com>/civicrm/admin/setting/url?reset=1 If not your images will be stored with an https:// protocol, but then CiviCRM removes the s when it tries to display them. Choosing Force Secure URLs is sensible anyway, if you are able to use https.

10. Re-install Payment Processors

Copy over the payment processor files from your old code folder or update the payment processor files if necessary. You may also want to run a test. See: Payment Processors

11. Enable Components

If you plan on using the new CiviCase component, or any components that you weren't using in the prior version (e.g. CiviPledge or CiviGrant for grant management) - you'll need to enable these component(s):

  • Go to Administer » Configure » Global Settings » Enable CiviCRM Components

If you have been using Cases in 2.2 and / or want to start using the CiviCase component, you will also need to complete additional configuration steps. Learn more...

12. Re-enable compatible CiviCRM integration / extension modules

Administer » Site Building » Modules

Go through your list of CiviCRM integration / extension modules and confirm compatibility with the new release if applicable. (If you've downloaded the module from Drupal.org - check the module's page for compatibility information.)

Re-enable all compatible modules by re-checking the Enabled box. You may want to do this "one at a time" if you're unsure of compatibility.

13. Review and Update Drupal Permissions Settings

  • It's a good idea to verify Drupal role-based permissions which were added in recent releases. You can review and update these at Administer » User Management » Permissions:
    • access CiviMail subscribe/unsubscribe pages : Enable this permission 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.
    • view event participants : If you want to allow some constituents to see a list of registered participants for a given event at http://<drupal_site>/civicrm/event/participant?id=N&reset=1, then enable this permission for the appropriate Drupal role(s).
    • 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.
    • Delete permssions - afrer you upgrade to 3.x users will not be able to delete contacts, contributions, activities etc unless you specifically enable these permissions

14. Clear Views' cache (for sites using Views 2 integration)

  • If you were using Views integration prior to this upgrade, you will need to go to Administer » Site building » Views » Tools and press "Clear Views cache" for Views to capture changes in the CiviCRM Views integration code.

15. Restore CiviCRM as the Drupal homepage if appropriate

If you changed the default Drupal homepage from civicrm to node in step 3 above, you need to restore civicrm as the homepage. You can do this by navigating to:
Administer » Site Configuration » Site Information
then change the Default front page to civicrm, and click Save configuration.

NB: As mentioned in 3 above, there are a variety of modules that may affect the Drupal homepage. Consult the appropriate module's documentation if you are using them to set the homepage to civicrm for the administrative action required to change your site's homepage back to CiviCRM.

16. Put the Site Online (for production site upgrades)

  • Toggle the following feature, and put your site back online:
    Administer » Site Configuration » Site Maintenance
  • Review Your upgraded site and verify that your data is intact.
  • Check out the new features and improvements. A summary of the cool new stuff can be found here.

17. Review background scripts

System Administrators: All CiviCRM-related cron jobs will stop working as soon as any site is upgraded to 4.1. Cron jobs will need to be reconfigured using the new Scheduled Jobs method.

In the previous versions, background jobs were handled with individual scripts. For reference, you may also want to refer to the Command-line Script Configuration to help you migrate your settings from the old scripts to the new centralized Scheduled Jobs method.

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.

CiviCRM 4.1.5 for Drupal 6 has two bugs

Two bugs slipped into 4.1.5 for Drupal six that you will need to patch by hand.  Both are simple one-line changes. One of the bugs will cause a program crash/error message every time a use logs out of Drupal, so you will want to fix the bugs before going into production:

#1. In civicrm_group_roles.module around line 510:

  Remove this line (or remark it out):  $contact = civicrm_group_contact_get($params);
  Replace it with this line: $contact = &civicrm_api('contact', 'get', $params);

#2. In civicrm_member_roles.module around line 500:

  Remove this line (or remark it out):   require_once 'api/v2/MembershipContact.php';
  Replace it with this line:   civicrm_api_include('membership', FALSE, 2);

More details about the two bugs and patch files for them are here.

Version information missing in civicrm database

Try running a query like this: 'UPDATE civicrm_domain SET version = '2.2.9' WHERE id = 1;'

Then try invoking the upgrade script again with your browser.

Non-recoverable error: Unknown column 'is_deleted' in 'field list', 1054 

Another Drupal module is accessing the database and the update process is being blocked. Disable any modules that interact or rely on CiviCRM, such as RealName. Perform the update, then enable those modules again.

Page Not Found error

if you get this error when trying to upgrade the database in step 7, you most likely disabled CiviCRM in step 3. Here's how to fix it and get back on track. In short, you have to restore the original version of civicrm, re-enable the module, and then replace the old files with the new.

  • Rename the sites/all/modules/civicrm folder to civicrm_new.
  • Copy the civicrm folder from your backup into sites/all/modules/
  • Go to Administer » Site Building » Modules, check the box next to CiviCRM, and click save.
  • Now rename sites/all/modules/civicrm to civicrm_old.
  • Rename sites/all/modules/civicrm_new to civicrm.
  • Go to Step 7 and try it again. Everything should be back to normal!!
  • If so, then don't forget to delete sites/all/modules/civicrm_old.

Reset Your User Session

If you are getting foreign key constraint errors when trying to add or modify records, you may need to reset your user session.

  • 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 an additional query string value (sessionReset=2) to the URL in your browser's location bar, and reload the page.

  • Now reset Enable Debuggingto 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.

Verify and Update Base Directory and Base URL Settings in the Database

If you are seeing problems with missing images or page styling, you may need to adjust the Base Directory and Base URL Settings in the database. You can do this from:
Administer CiviCRM » Configure raquo; Update Directory Path and URL

Verify and Update Configuration Settings File

CiviCRM in versions 2.2 stores most configuration settings in the database. However values needed to load the code and database are stored in the settings file and may need to be updated prior to beginning the upgrade process if you are upgrading a copy of your working 2.2 site:

<drupal home>/sites/xxx/civicrm.settings.php (usually /sites/default/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 previous version, update this setting with the new path.
    • CIVICRM_TEMPLATE_COMPILEDIR : If you are running this installation in a different directory from your previous version, update this setting with the new path.
    • CIVICRM_UF_BASEURL : If the Drupal URL for this site is different from your 2.2 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_DSN: This setting must contain the correct information for your current (not yet upgraded) database. If you are upgrading a copy of your database that has a different database name - 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 database that will be used for 3.4.

    • CIVICRM_SITE_KEY : If you are upgrading to 3.4 from a version earlier than 2.0.7, you will need to define your CIVICRM_SITE_KEY. Components such as CiviMail's cronjob will not function without the site key with CiviCRM 3.4. Learn how to define the site key here: http://wiki.civicrm.org/confluence/display/CRMDOC/Command-line+Script+Configuration

A fatal error appears when I try to load a CiviCRM page.

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 or this procedure (on the forum) to reload your data into a new 3.4 database structure if you are having this type of issue with upgrading your database.

Upgrade script fails with fatal database-related errors OR reports "Database check failed"

Download and run Database Troubleshooting Tools to test the current state of the database and provides a diagnosis. The tools suite also includes a repair facility.

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.

Access Forbidden (403) Error After Upgrade

This may be caused by directory permission settings. Make sure your <drupal home>/files/civicrm directory is set with chmod a+rwx -R
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. Then re-enable clean URLs.

Screen grays out and a camera icon appears whenever  you click any link in CiviCRM

This error is caused by a known problem in the Drupal Lightbox2 module.  Either disable the module in Administer » Site Building » Modules or upgrade to the dev version of the Lightbox2 (dated July 2009 or later) that fixes this issue.

Reset config_backend

Having strange problems with Administrative settings forms after upgrade? Try this: http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=2981949 or try deleting all files in [yoursite]/sites/default/files/civicrm/templates_c/

UpdateMembershipRecord.php won't run after upgrading from prior versions

Double check that there is a Membership Status Rule called "Deceased" and that it is active in Administer » CiviMember » Membership Status Rules. The solution is described in this forum thread.

The menus are wrong, the admin dashboard does not have the correct links and settings, or get an error with CRM_Core_Invoke::require_once()

You can re-build the menu/admin dashboard by visiting the following url - (http:///civicrm/menu/rebuild?reset=1 (http://%3cdomain%3e/civicrm/menu/rebuild?reset=1)

Version information missing in civicrm database error

Try running a query like this: 'UPDATE civicrm_domain SET version = '2.2.9' WHERE id = 1;'

Then try invoking the upgrade script again with your browser.

CiviMail mailings stuck in "Running" / CiviMail cron task fails to execute

Permission requirements for the user who executes the CiviMail cron task may be more stringent following the upgrade. Double check that the user has sufficient permissions to access the mailings and contact records.

Running /civicrm/upgrade?reset=1 results in "DB Error: No such table"

If you are upgrading from CiviCRM 3.3 or earlier under Drupal 6 and running /civicrm/upgrade?reset=1 results in "DB Error: No such table", you may need to upgrade to successive versions, for example from 3.3 to 3.4 to 4.1.  If the upgrade script gives an error like this, the database will be partly updated and the update script will not be able to run again–so you will need to restore the SQL database from your backup before proceeding.  See this thread for more information.

All you see is the word "Array" when you load /civicrm/upgrade?reset=1

The CIVICRM_UF parameter is not correctly changed to "Drupal6" (step 6 above).  Be sure you changed the actual parameter and not the example in the comments.

Labels