CiviCRM Upgrade


Important lesson today during a CiviCRM upgrade.

Do not save the old copy of CiviCRM code in /sites/all/modules!

If you see an error similar to the following then you almost certainly have two copies of the CiviCRM code -

[08-Apr-2016 18:08:14 Europe/London] PHP Fatal error:  Cannot redeclare class CRM_Core_ClassLoader in /var/www/vhosts/crm-demo.medicaldetectiondogs.org.uk/sites/all/modules/civicrm/CRM/Core/ClassLoader.php on line 36

In my case I had downloaded the new version and saved the old version in /sites/all/modules, e.g.

# cd sites/all/modules
sites/all/modules# wget https://download.civicrm.org/civicrm-4.6.15-drupal.tar.gz
sites/all/modules# mv civicrm civicrm-4.6.13
sites/all/modules# tar xvzf civicrm-4.6.15-drupal.tar.gz

This is very bad. The correct sequence is (substituting the correct CiviCRM version of course)

# cd sites/all/modules
sites/all/modules# wget https://download.civicrm.org/civicrm-4.6.15-drupal.tar.gz
sites/all/modules# mv civicrm /tmp/civicrm-4.6.13
sites/all/modules# tar xvzf civicrm-4.6.15-drupal.tar.gz

Simples. Moving the old code tree outside of the normal code tree solves the problem.

Comment on this article using form below. Requires email login only for authentication. HTML forbidden, Markdown only.