1

I'm having some problems with the CiviCRM Resource URL setting that I can't get my head around. Set as [civicrm.root]/ the System Status screen displays the error 'The Resource URL is not set correctly'. Set as [cms.root]/sites/all/modules/civicrm/ everything seems to work fine (until I try to upgrade). But surely both should resolve to the same place?

In the File System Paths section of civicrm.settings.php I have the following:

$civicrm_root = '/var/sites/c/beta.example.net/public_html/sites/all/modules/civicrm';
if (!defined('CIVICRM_TEMPLATE_COMPILEDIR')) {
  define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/sites/c/beta.example.net/public_html/sites/default/files/civicrm/templates_c/');
}

And in the Site URLs section I have:

if (!defined('CIVICRM_UF_BASEURL')) {
  define( 'CIVICRM_UF_BASEURL'      , 'https://example.net/');
}

Trying to load the with the [civicrm.root]/ setting results in a load of javascript errors, of which the following is an example:

[Error] Failed to load resource: The request timed out. (logo_sm.png, line 0) https://var/sites/c/beta.example.net/public_html/sites/all/modules/civicrm/i/logo_sm.png

That looks as though $civicrm_root is set incorrectly, but it seems to be right in accordance with the examples given in the comments. What am I missing?

Edit: If I go to the CiviCRM Resources URLs page and click on ? I see the variables listed as:

[cms.root]  https://example.net/
[civicrm.root]  https://example.net//var/sites/c/beta.example.net/public_html/sites/all/modules/civicrm/
[civicrm.files] https://example.net/sites/default/files/civicrm/

But if I got to the Directories page and do the same, I see

[cms.root]  /var/sites/j/example.net/public_html
[civicrm.root]  /var/sites/c/beta.example.net/public_html/sites/all/modules/civicrm
[civicrm.files] /var/sites/c/beta.example.net/public_html/sites/default/files/civicrm

Where are these getting calculated from that means they're producing different results? Particularly that random one with the /j/ in the middle, which I've never seen before anywhere!

  • 1
    I had a similar problem after upgrading to 5.23.4 from 5.20.0. Mine was due to cron calling drush with a -r parameter which was a symbolic link to the drupal directory, equivalent but not identical to the path used to specify $civicrm_root. This used to work, but now caused links in emails to have a path like example.com/drupal//var/www/clients/client1/web1/web/drupal/…. After changing the drush -r parameter to /var/www/clients/client1/web1/web/drupal my problem was resolved. Check for inconsistent use of symbolic links in all resource paths/urls. – BobS Mar 31 at 16:25
  • 1
    What is your drupal path set in apache or nginx config? – Pradeep Nayak Mar 31 at 19:36
  • @PradeepNayak How do I find that out? Drupal is installed at /var/sites/example.net/public_html/ but I'm on shared hosting, so I don't have access to anything above /var/sites/example.net/. – somnolentsurfer Apr 1 at 11:01
  • @BobS Any hints on where to start looking? I'm not using drush. I don't have any custom code, and find . -type l -ls returns nothing. – somnolentsurfer Apr 1 at 11:15
  • 1
    Can you go to CiviCRM directories page and click on '?' and paste all the variables – Pradeep Nayak Apr 1 at 12:49
3

In your civicrm.setting.php update the $civicrm_root and template_c path to use /var/sites/j/example.net/public_html instead of /var/sites/c/beta.example.net/public_html/

Thanks

Pradeep

| improve this answer | |
  • I don't really understand it, but it works. Thanks! – somnolentsurfer Apr 1 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.