CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • cannot set base url / civiccrm global root correctly?
Pages: [1]

Author Topic: cannot set base url / civiccrm global root correctly?  (Read 808 times)

Eli Brasse

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 7.32
  • MySQL version: 5.5.37-cll
  • PHP version: 5.4.32
cannot set base url / civiccrm global root correctly?
October 28, 2014, 06:00:47 pm
I am having trouble setting the global $civicrm_root in civicdm.settings.php

Following the instructions in the file commenting, and advice from my host, the root setting should be:

$civicrm_root = '/home/example/public_html/civi/sites/all/modules/civicrm/';

for a site that has a public url of http://civi.example.org

and a base url that is consequently set as

define( 'CIVICRM_UF_BASEURL'      , 'http://civi.example.org/' );

However, these settings don't seem to work. Well, mostly they are fine, but the image uploader (kcfinder) and external links in mailings both return "page not found" errors. I have used a work-around bit of code for the above problem and think this might be the cause of the "page not found" trouble. Here's the workaround:

global $civicrm_root;

if (function_exists('drupal_get_path') && function_exists('conf_path')) {
  $drupal_root = DRUPAL_ROOT;
  $civicrm_module_dir = drupal_get_path('module', 'civicrm');
  if (preg_match('#^(.*/)drupal$#', $civicrm_module_dir, $m)) {
    $civicrm_root = $m[1];
  }
  else {
    throw new Exception('Unable to determine CiviCRM root path.');
  }
  $civicrm_conf_dir = conf_path();
}
elseif (preg_match('#^((.*)/sites/([^/]+)/modules/(|[^/]+/)civicrm)/extern/([^/]+)\.php$#', $_SERVER['SCRIPT_FILENAME'], $m)) {
  $drupal_root = $m[2];
  $civicrm_root = $m[1] . '/';
  if ($m[3] === 'all') {
    $civicrm_conf_dir = $m[2] . '/sites/default';
  }
  else {
    $civicrm_conf_dir = $m[2] . '/sites/' . $m[3];
  }
}
else {
  throw new Exception('Unable to determine CiviCRM root path.');
}

define( 'CIVICRM_TEMPLATE_COMPILEDIR', $civicrm_conf_dir . '/files/civicrm/templates_c/' );

error_reporting(0);


Any advice?


Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: cannot set base url / civiccrm global root correctly?
October 29, 2014, 04:31:04 am
Why are you trying to set $civicrm_root manually?

One option anyhow, is to remove civicrm.settings.php, install fresh into a temporary DB and then edit that new file to point to the real DB. Then $civicrm_root will be correct.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • cannot set base url / civiccrm global root correctly?

This forum was archived on 2017-11-26.