CiviCRM on Pantheon

By Mike Pirog,

If you have ever tried moving an existing installation of CiviCRM to another server you know that it is tantamount to some of the most weird and sadistic branches of masochism. In fact, we'd rather have Ivan Drago punch us repeatedly in the kidney than try to get CiviCRM to live anywhere else than the place it was originally spun up.

So if you are one of the many wise and astute Drupalists now migrating sites to the magical Pantheon Platform and have secret aspirations of bringing CiviCRM along for the ride, heed the following advice. This will be a little more complicated than the “normal” CiviCRM migration.

Now that we’ve instilled you with the respect becoming of this formidable task, know that it’s actually not that bad. In fact we’ve already done it a couple of times and would like to share our experiences with you.

We are going to assume that you are moving a pre-existing site into Pantheon from some other server out there in the vast expanse of the Internet. We are also going to assume that you are at least generally familiar with the documentation that CiviCRM provides concerning migration, as we will reference it going forward. Finally, and for the sake of full disclosure, this documentation was prepared using Drupal 6/CiviCRM 4.1.1, so mileage may vary depending on your environment.

Anyhow, here are some steps to help you along the way.

1. Backup Your Site

As far as we are concerned, if you start any sort of significant migration attempt without doing this first then you get what you deserve. Insomnia, anguish and feelings of helplessness will be coming your way should you by happenstance stumble upon a maelstrom of code fury that woulda, coulda, shoulda been easy to fix with a backup. Anyway... onward!

2. Get Your Site Up and Running On Pantheon Sans CiviCRM

A good second step is to disable CiviCRM before you import your site into Pantheon. Make sure that you disable but DO NOT UNINSTALL CiviCRM. If for whatever unsavory reason you do in fact decide to uninstall CiviCRM then the importance of Step 1 will become either pleasantly or regrettably obvious to you.

If you are planning on importing your files directory or adding your files via SFTP later please make sure that you have deleted all the files in

3. Verify Your Import

You should take time to make sure your site is running without issues on Pantheon before you begin the CiviCRM migration process.

Once you verify that your site is up and problem free on Pantheon we would recommend pushing your code and content to both the test and live environments before the next step.

4. Apply Kalamuna Code Science

As you may or may not know Pantheon manages most of the settings.php Drupal configuration that you have undoubtedly come to love as a developer. This behind the scenes wizardry allows Drupal to work on three environments while using only a single codebase. Magical Indeed!

To get CiviCRM to work on Pantheon we need to employ similar techniques.

First, if you are using a local development environment then good for you. You can now feel free to go through civicrm.settings.php and replace the values from your old server with the values that make sense for your local environment. Take in the moment/experience as you wipe away some of the last evidence of your previous host.

Second, you will want to add the code snippet labeled “CODE SCIENCE EXHIBIT A” directly AFTER this line
define( 'CIVICRM_UF' , 'Drupal6' );
and also most definitely BEFORE all the constants you may or may not have just defined for you local environment.


 * Pantheon Systems:
 * Repopulate needed variables based on the Pantheon environment if applicable.
  $env = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
  if (!empty($env['conf']['pantheon_binding'])) {
    $pantheon_db = $env['databases']['default']['default'];
    $pantheon_conf = $env['conf'];

    //user name and password
    $db_string = $pantheon_db['driver'] . '://' . $pantheon_db['username'] . ':' . $pantheon_db['password'] . '@';
    $db_string .= 'dbserver.' . $pantheon_conf['pantheon_environment'] . '.' . $pantheon_conf['pantheon_site_uuid'] . '' . ':' . $pantheon_db['port'];
    // database
    $db_string .= '/' . $pantheon_db['database'] . '?new_link=true';

    // define the database strings
    define('CIVICRM_UF_DSN', $db_string);
    define('CIVICRM_DSN', $db_string);

    // define the file paths
    global $civicrm_root;

    $civicrm_root = '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/code/' . str_replace('drupal', '', drupal_get_path('module', 'civicrm'));
    define('CIVICRM_TEMPLATE_COMPILEDIR', '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/files/civicrm/templates_c/');

    // Use Drupal base url and path
    global $base_url, $base_path;
    define('CIVICRM_UF_BASEURL', $base_url . '/');

Save the file, commit the code and push it up to the Pantheon development environment with git (or directly edit it with SFTP).

Once your code is in the development environment clear your caches and pull the new code in from the test environment and then from the live environment before doing anything else.


5. Continue with the normal migration directions from CiviCRM detailed below

  1. Login to Drupal or to Joomla Administrator and enter the following URL in your browser:
    • Drupal sites: http:///index.php?q=civicrm/admin/setting/updateConfigBackend&reset=1
    • Joomla sites: http:///administrator/index2.php?option=com_civicrm&task=civicrm/admin/setting/updateConfigBackend&reset=1
  2. 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.
    1. 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).
    2. Otherwise click Save.
  3. 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:///index.php?q=civicrm/menu/rebuild&reset=1
    • Joomla sites: http:///administrator/index2.php?option=com_civicrm&task=civicrm/menu/rebuild&reset=1
  4. 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).
  5. 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.
  6. Page through the Configuration Checklist at Administer CiviCRM > Configuration Checklist to be sure that all your settings are correct.


6. Repeat step 5 on your Test and Live environments


7. Success!



If you have any additional issues please consult the documentation at CiviCRM, specifically this document.

Known Issues:

While this approach does let you run CiviCRM on Pantheon, it is not without problems. CiviCRM is still, in many ways, a standalone product and as such not all of its code runs under the assumption that Drupal has bootstraped. As a result some functionality is not yet available with CiviCRM on Pantheon. Specifically, enabling click-through tracking on CiviMail produces bogus links in its mailing.
Kalamuna is currently working with the CiviCRM community to resolve this issue and highly encourages you to participate as well:,24556.0.html

We've been told that the above has been fixed in the latest versions of CiviCRM.


From time to time we have experienced CiviCRM throwing a fatal error on Drupal 6.  This seems to happen when the binding ID is changed on the Pantheon end and the error is traceable to Config.IDS.ini, a file that is cached in sites/default/files/civicrm/ConfigAndLog/.  When the bindings change this file needs to be deleted so that it can be regenerated with the new bindings.  This can be done manually, but we have put together a small module that will do it for you so you don't have to worry about downtime.

Mike Pirog


Kalamuna's former Chief Technology Officer was born from the hot liquid metal of mathematics, poured into the mold of scientific skepticism and finally forged with the hammer of a hard-nosed New England attitude. This trifecta of awesomeness helps keep Kalamuna producing both innovative and high-quality products. He can also do backflips.