 | A number of settings stored in CiviCRM's database relate to the physical location in the server file system and the URL path. When you move an existing CiviCRM installation to a new server (or a new location on the same server) - these settings usually need to be changed. This documentation covers the general steps. Procedure applies to CiviCRM 2.0 + |
 | These instructions have been rewritten based on my recent migration experience and are also informed by this blog post: http://civicrm.org/blogs/eileen/drush-bam-civi-wham. The overall process I am suggesting is to install a fresh working copy of CiviCRM on your new server. Next copy any custom code then move the majority of your database from the old server, ignoring domain and cache tables. This leaves the good working domain data in place on your new server. |
- Disable but do not uninstall CiviCRM in your CMS.
- Copy the codebase files or execute a fresh install of your CMS to the new location.
- If you decide to do a fresh install, you will also need to recreate your (non-CiviCRM) installed module base.
- Do not copy your civicrm.settings.php from the old server, rather, install a clean copy of CiviCRM: Installation and Upgrades
- Copy your databases.
- Drupal: Consider Backup and Migrate Module to migrate the Drupal side. If your CiviCRM data is in a seperate database, Backup and Migrate can also backup your CiviCRM data but it cannot ignore tables. Ignored tables skirts alot of issues and this guide assumes that you are ignoring at least the civicrm_domain table.
- Command Line: Substitute mysql_username, cms_db_name and dump_file_name_of_your_choice with appropriate values.
On the old server:
$ mysqldump -u mysql_username -p drupal_db_name > drupal_dump_file_name_of_your_choice.sql
$ mysqldump -u mysql_username -p --ignore-table=civicrm_db_name.civicrm_domain \
--ignore-table=civicrm_db_name.civicrm_acl_cache \
--ignore-table=civicrm_db_name.civicrm_acl_contact_cache \
--ignore-table=civicrm_db_name.civicrm_cache \
--ignore-table=civicrm_db_name.civicrm_group_contact_cache \
civicrm_db_name > civi_dump_file_name_of_your_choice.sql
On the old server:
$ mysqldump -u mysql_username -p --ignore-table=joomla_db_name.civicrm_domain \
--ignore-table=joomla_db_name.civicrm_acl_cache \
--ignore-table=joomla_db_name.civicrm_acl_contact_cache --ignore-table=joomla_db_name.civicrm_cache \
--ignore-table=joomla_db_name.civicrm_group_contact_cache \
joomla_db_name > dump_file_name_of_your_choice.sql
- Load your database(s) into to the new MySQL server
- Drupal: Again consider Backup and Migrate Module to migrate the Drupal side.
- Command Line: Substitute mysql_username, cms_db_name and dump_file_name_of_your_choice with appropriate values.
On the new server:
$ mysql -u mysql_username -p drupal_db_name < drupal_dump_file_name_of_your_choice.sql
$ mysql -u mysql_username -p civicrm_db_name < civi_dump_file_name_of_your_choice.sql
On the new server:
$ mysql -u mysql_username -p joomla_db_name < dump_file_name_of_your_choice.sql
- Delete files with cached settings
- Drupal:
- <drupal-root>/sites/default/files/civicrm/templates_c/* (cached versions of Smarty templates that will be rebuilt)
- Joomla:
- <joomla-root>/media/civicrm/templates_c/*
- Standalone
- <standalone-root>/standalone/files/civicrm/templates_c/*
- Login to Drupal or to Joomla Administrator and enter the following URL in your browser:
- Drupal sites: http://<drupal_site>/index.php?q=civicrm/admin/setting/updateConfigBackend&reset=1
- Joomla sites: http://<joomla_site>/administrator/index2.php?option=com_civicrm&task=civicrm/admin/setting/updateConfigBackend&reset=1
- Review the recommended modified paths in the form - they should reflect the new Base Directory and Base URL for CiviCRM.
 | Base Directory - For Drupal installs, this is the absolute path to the location of the 'files' directory. For Joomla installs this is the absolute path to the location of the 'media' directory.
Base URL - This is your Drupal or Joomla site URL (e.g. http://www.mysite.com/drupal/). |
- If these values do NOT look correct, then recheck the changes you made to civicrm.settings.php. If everything looks right in your civicrm.settings.php file, you may want to follow the directions for setting config_backend to null in the Troubleshooting section (below).
- Otherwise click Save.
- Rebuild the menus. The menu links in the civicrm_menu table contain full URL links and need to be updated with the new domain.
- Drupal sites: http://<drupal_site>/index.php?q=civicrm/menu/rebuild&reset=1
- Joomla sites: http://<joomla_site>/administrator/index2.php?option=com_civicrm&task=civicrm/menu/rebuild&reset=1
- If you made any non-CiviCRM changes to your site (e.g. exposed profiles on the Drupal nav bar) don't forget to fix (e.g. for Drupal: Administer >> Site building >> Menus >> Navigation).
 | Your 'files' directory is typically outside of your CiviCRM install directory. The below step is important for proper operation on a new site |
Go to Administer CiviCRM > Configure > Global Settings. If you are using custom templates or PHP then you'll need to click on Directories to update the directory locations for these (/civicrm/admin/setting/path?reset=1). You should click on Resource URLs to ensure these are correct.
- Page through the Configuration Checklist at Administer CiviCRM > Configuration Checklist to be sure that all your settings are correct.
Your site should now be properly configured for its new location.
Trouble-shooting
Unable to update Config Backend
This process should avoid this error, however if after entering the "updateConfigBackend" URL you may get an error suggesting you need to set the Config_Backend column to NULL. Please execute the following sql in your database (using mysql shell or PHPMyAdmin)
 | This field contains many other useful CiviCRM configuration settings, such as what components are enabled, your mailserver setting, what countries are enabled, etc. You should only NULL this as a last resort. |
USE <yourdatabasename>;
UPDATE civicrm_domain SET config_backend = null;