Skip to end of metadata
Go to start of metadata
CiviCRM Documentation

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 +

This procedure is a "draft" and needs to be verified and improved on as people use it.

  1. Copy the codebase files to the new location.
  2. Copy the CiviCRM settings file(s) - civicrm.settings.php - to the new server / location. Drupal installs will generally have one settings file in <drupal_root>/sites/default. Joomla installs have two settings files: <joomla_root>/components/com_civicrm and <joomla_root>/administrator/components/com_civicrm.
  3. Copy your database(s) to the MySQL server if needed. (You can use mySQLdump or phpMyAdmin to dump the structure and content of your CiviCRM / CMS database(s)).
  4. Review the settings file(s) - and modify the following settings as needed:
    • CIVICRM_UF_DSN
    • CIVICRM_DSN
    • civicrm_root
    • CIVICRM_TEMPLATE_COMPILEDIR
    • CIVICRM_UF_BASEURL
  5. Update the following file so it uses the correct path:
    • <joomla_root>/administrator/components/com_civicrm/civicrm/civicrm.config.php
    • <drupal_root>/sites/default/civicrm.settings.php
  6. Empty civicrm_menu table, ( TRUNCATE TABLE `civicrm_menu` )
  7. Login to Drupal or to Joomla Administrator and enter the following URL in your browser:
    • Drupal sites: http://<drupal_site>/civicrm/admin/setting/updateConfigBackend?reset=1
    • Joomla sites: http://<joomla_site>/administrator/index2.php?option=com_civicrm&task=civicrm/admin/setting/updateConfigBackend&reset=1
  8. 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>/civicrm/menu/rebuild?reset=1
    • Joomla sites: _http://<joomla_site>/administrator/index2.php?option=com_civicrm&task=civicrm/menu/rebuild?reset=1
  9. 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
  • Otherwise click Save.
  1. Delete files with cached settings if you have copied files over into the 'files' directory.
    • delete /civicrm/upload/Config.IDS.ini (contains URL values and will be rebuilt with correct settings if deleted)
    • delete /civicrm/templates_c/* (cached versions of Smarty templates that will be rebuilt)

Your site should now be properly configured for it's new location but take a moment to check that the paths configured on the following pages appear to be correct.

CiviCRM › Administer CiviCRM › Global Settings Settings - Upload Directories Administer CiviCRM
CiviCRM › Administer CiviCRM › Settings - Update Directory Path and URL
CiviCRM › Administer CiviCRM › Global Settings >Settings - Resource URLs

Labels
  • None
  1. Sep 10, 2008

    Base directory, or Base Dir expects the absolute path of "files" directory. In drupal 5.x, it resides just inside the drupal directory e.g drupal/files. So you 'll need to enter something like - /var/www/example.org/files/
    (adjustment may be required here as per your setup).

  2. Sep 10, 2008

    Another comment here. I followed the steps set out above, and got the following screen when I attempted to navigate to my site after completing step 4:
    "Error: Could not create directory: /Users.
    If you have moved your database from a development install to a production install and the direcotory paths are different, please set the column config_backend in the civicrm_domain table to NULL. You will need to reinitialize your settings in the production install."
    not too sure what "You will need to reinitialize your settings in the production install." actually means, but we soldier on.

  3. Dec 30, 2008

    If you are copying over the files directory too make sure that the ownership of the files directory is for the user running apache.

    We rsynced the code from our staging to production server and the ownership of the files directory on the production was not 

    set to that of the user running apache.

    $ pwd
    /opt/httpd/htdocs/www/production/asfonline/sites/default/files
    $ chown -R daemon:daemon civicrm

  4. Feb 15, 2009

    Hi there,

    Some things that you might like to consider when it comes to improving these instructions (I'd edit the instructions myself but not 100% about this process (smile)).

    Have moved two sites.  I came across Graham and Yashesh's problems as well.

    Things were redirecting back to my old URL which was confusing as both the sites looked the same.  Might be worth drawing people's attention to the fact that you should be sure that you are looking at your new site.

    I had to change ownership of files/ like Yashesh said

    Is there any reason why files needs to be owned by www-data?  I presumed that as long as it had write permission with "chmod g+w files" then things would be ok.

    Following instructions on error page, I had to set config_backend in the civicrm_domain table to NULL a few times as it kept on resetting.  I presume there is an optimal place in the process to do this)

    The first few times I tried to reach civicrm/admin/setting/updateConfigBackend?reset=1 I couldn't get there - I saw the screen but none of the fields were visible until I cleaned my cache and reset some file permissions.

  5. Dec 22, 2009

    The link published here in step 8 to rebuild the menus did not work for me: "Drupal sites:  http:///civicrm/menu/rebuild?reset=1"

    I was trying:  http://localhost/index.php?q=civicrm/menu/rebuild?reset=1

    After over a day of searching I found this link http://www.journeymm.com/blogs/drupal/clearing-civicrm-cache which did rebuild the menu cache

    http://localhost/index.php?q=civicrm/menu/rebuild&reset=1

    "&" instead of "?"  - don't know why that made all the difference I'm using a Mac OS 10.5.8

    I posted on the forum here http://forum.civicrm.org/index.php/topic,11005.0.html

    I wanted to also comment on the 3.0 documentation but can't see an add comment link -  http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location


Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.