SAC:Setup CiviCRM

From OSGeo
Jump to: navigation, search

CiviCRM is a Drupal Package for managing memberships, donations, etc. The hope is to use it to handle the membership management needs we've had going for a long time - but without having to create a whole bunch of custom content types ourselves.

Problems

  • CSS isn't perfect in Safari, especially for administration forms, using Firefox is recommended. If this affects public/non-admin pages then we'll have to fix the css somehow

Install CiviCRM

Following instructions from the CiviCRM 1.8 install for Drupal

  • unzip tar ball into ~/src/civicrm

Create Folders for Drupal

Create folders with write permissions:

  • /var/www/html/files/civicrm/crm_docs/
  • /var/www/html/files/civicrm/templates_c/
  • /var/www/html/files/civicrm/upload/
cd /var/www/html/files/
sudo mkdir civicrm
sudo mkdir civicrm/crm_docs
sudo mkdir civicrm/templates_c
sudo mkdir civicrm/upload
sudo chown -R apache.apache civicrm

Drupal Page Caching

To disable page caching for CiviCRM pages, added to /var/www/html/sites/osgeo.org/settings.php:

$conf = array(
  'file_directory_path' => conf_path() .'/files', // not needed for this, but probably exists
  'page_cache_fastpath' => 1,
);
function page_cache_fastpath() {
if (substr($_GET['q'], 0, 7) == 'civicrm' || substr($_GET['q'], 0, 4) == 'user') {
    global $conf;
    $conf['cache'] = CACHE_DISABLED;
  }
}

Set Up Database

I chose to keep the CiviCRM database separate from Drupal.

Install CiviCRM Code

sudo mv civicrm /var/www/html/modules/
sudo chown -R apache.apache /var/www/html/modules/civicrm

Load CiviCRM Database

cd /var/www/html/modules/civicrm/sql
# Following uses _41 file even though mysql is ver 5
mysql -u civicrm_user  -p civicrm_database < civicrm_41.mysql
# Following loads default sample contacts, re-run above to have the db cleared after testing
mysql -u civicrm_user  -p civicrm_db < civicrm_generated.mysql

All ran without any trouble.

Edit CiviCRM Configuration File

cd /var/www/html/modules/civicrm
cp civicrm.settings.php.sample /var/www/html/sites/osgeo.org/civicrm.settings.php
Edit this file and set various settings where needed, in particular each of these lines was edited:
define( 'CIVICRM_UF_VERSION'       , '4.7' );
define( 'CIVICRM_UF_DSN'           , 'mysql://drupaluser:PASSWORD@localhost/drupal_db?new_link=true' ); # Drupal DB
define( 'CIVICRM_MYSQL_VERSION', 5.0 );
define( 'CIVICRM_DSN'          , 'mysql://crmuser:PASSWORD@localhost/civicrm_db?new_link=true' ); # CiviCRM DB
$civicrm_root = '/var/www/html/modules/civicrm/';
define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/html/files/civicrm/templates_c/' );
define( 'CIVICRM_UF_BASEURL'      , 'http://www.osgeo.org/' );

Enable CiviCRM Module and Blocks

  • In Drupal admin menu, select Modules and turn on civicrm. Do the same with Blocks. This should be all we need.
  • Set Access Control for CiviCRM in the normal Drupal access control admin menu. For now, admins and project managers can add/edit contacts, etc.