Home > Open Source, Technology > Configuring multiple CiviCRM on single Drupal

Configuring multiple CiviCRM on single Drupal

This instructions were originally written for Ubuntu, but can be used for other operating systems.

We will setup http://civicrm , which will be on CiviCRM trunk and http://civicrm21, which will be on CiviCRM v2.1 branch.

1. Download Drupal from drupal.org. Untar and copy it to /var/www/drupal-6.6.
2. We need multi-site Drupal setup. So create “civicrm” folder in sites/ .
3. Now we need to define Virtualhost in apache. You can read instructions from: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
OR you can follow my instructions:

i) In your /etc/apache2/site-available. Create new file civicrm and copy below code
<VirtualHost *:80>
ServerName civicrm

DocumentRoot /var/www/drupal-6.6
<Directory /var/www/drupal-6.6/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/civicrm_error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/civicrm_access.log combined

</VirtualHost>

ii) sudo a2ensite civicrm
iii) sudo /etc/init.d/apache2 restart

This will create apache virtual host.

Then modify your /etc/hosts and to add new site “civicrm”

127.0.1.1    civicrm

Restart your network: sudo /etc/init.d/networking restart

4. Now you new site is ready and you can install drupal using http://civicrm

While installing you might get errors like;

“Copy the ./sites/civicrm/default.settings.php file to ./sites/civicrm/settings.php”

So copy sites/defaults/default.setting.php to sites/civicrm/settings.php

If you want clean url’s edit your .htaccess accordingly.

Important Note:

For your second site ie. http://civicrm21 you need to follow few more steps:
- take a drupal database table “system” dump (structure and data)
- create another new table for 21_system with above above dump
- add db prefix in your settings.php
$db_prefix = array( ‘system’ => ’21_’);
- specify $cookie_domain in your settings.php ( for eg civicrm21 )

5. After that install CiviCRM, you can get it from http://civicrm.org

Untar and copy civicrm folder in “sites/civicrm/modules/”.

Just in case you are running civicrm from svn. Then your settings_location.php should be like:

define( ‘CIVICRM_CONFDIR’, ‘/var/www/drupal-6.6/sites/civicrm’ );

For installing another instance of civicrm you need to create another site in drupal. So sites/civicrm21. Then repeat above steps.

So http://civicrm (CiviCRM trunk) and http://civicrm21 (CiviCRM v2.1)

Enjoy CiviCRM and Drupal :)

  1. RYErnest Dec 1st, 2008 @ 13:16 | #1

    Nice post u have here :D Added to my RSS reader

  2. xavier Feb 4th, 2009 @ 01:08 | #2

    Hi,

    I remember there is a magic variable to set so the civicrm can be in a different place (say /usr/src/civicrm.trunk) and symlink it in /var/www/drupal/sites/all/modules

    Dare detailing how to do that config ?

    Moreover, I haven’t be successful with crons, and rest apis, is there a way to make it work ?

    X+

  3. kurund Feb 6th, 2009 @ 14:23 | #3

    My multi-site structure :

    v2.1: sites/civicrm21/modules/civicrm
    v2.2: sites/civicrm22/modules/civicrm
    trunk: sites/civicrm/modules/civicrm

    As confirmed with drupal guys you cannot have same module, but multiple paths in system table.
    So I created 22_system table with dump from system table and added $db_prefix = array( ‘system’ => ’22_’) in my sites/civicrm22/settings.php, which mean I have separate system table for each multi-site.

    May be not recommended approach but worked for me

    Also check forum thread: http://forum.civicrm.org/index.php/topic,6458.0.html

    Kurund

Submitting Comment, Give me a second...

Leave a comment

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackbacks & Pingbacks ( 0 )
  1. No trackbacks yet.