4

I believe [civicrm.root] is being computed incorrectly. Entering the absolute URLs in Settings > Resource URLs has been sufficient to fix most problems, but some problems persist.

For example, when i encounter an error like crm.ckeditor.js getting an error, the console tells me it can't find it at https://mysite.org/mysite.org/wp-content/plugins/civicrm/civicrm/js/wysiwyg/crm.ckeditor.js.

You'll notice that mysite.org is repeated.

I'm running (CiviCRM 4.7.22) on an "Addon Domain" on my host. When you manage files for your addon domains, they show up as a folder on in your file manager. So my Civi files are installed at:

  • /home/username/public_html/mysite.org/wp-content/plugins/civicrm/civicrm/

I assume that when Civi is computing the [civicrm.root] variable, it just assumes it can replace /home/username/public_html with the base url defined by CIVICRM_UF_BASEURL, which would explain why I'm getting this https://mysite.org/mysite.org/wp-content....

So how do I fix this permanently? Clearly using absolute URLs in Settings > Resource URLs isn't sufficient for every case. To clarify the values frrom settings.civicrm.php:

  • define( 'CIVICRM_UF_BASEURL' , 'https://mysite.org/');
  • $civicrm_root = '/home/user/public_html/mysite.org/wp-content/plugins/civicrm/civicrm/';
  • 1
    [civicrm_root] is calculated from $civicrm_root, which is defined in civicrm.settings.php. You should edit civicrm.settings.php to use CKEditor. As to your original question - 90% of what's posted here is a red herring. Could you please rewrite the question to be reflective of what you've found regarding the calculation issue? – Jon G - Megaphone Tech Aug 12 '17 at 19:09
  • Rewrote for clarity. I know that [civicrm.root] is defined in civicrm.settings.php but I need to know what to change so that my URLs are calculated correctly. – Tomulent Aug 14 '17 at 17:15
  • 1
    Can you please edit your question to include the values of CIVICRM_UF_BASEURL and also of $civicrm_root? I'm having a hard time visualizing the values from the outputs. – Jon G - Megaphone Tech Aug 14 '17 at 18:47
  • Edited. Thanks for sticking with me :). I think the issue is stemming from the fact that the files are in a directory called mysite.org. – Tomulent Aug 14 '17 at 19:27
  • Hmm - I think you might be hitting the WordPress CiviCRM symlink issue. Is there a symlink in your file path? Particularly to mysite.org? – Jon G - Megaphone Tech Aug 14 '17 at 21:53
3

tl;dr: Uncomment and fill in the define('CIVICRM_CMSDIR', '/path/to/install/root/'); in civicrm.settings.php.

I traced through the functions that go toward building the URL for loadins crm.ckeditor.js. It seems there's a problem with the logic of the WordPress cmsRootPath function.

I can't tell you what the specific issue you're having that's causing that function to fail; I know it struggles with symlinks, and I'd guess there's other edge cases as well.

If I understand this line of code correctly, in addition to $civicrm_root, there's also a lesser-known cousin CIVICRM_CMSDIR, which is actually the relevant data here. In my 4.7.22 WordPress instance's civicrm.settings.php, that constant is present but commented out.

See also: CRM-18221 for what appears to be a similar issue on earlier versions of Civi 4.7.

  • 1
    Uncommenting the global $civicrm_setting and defining CIVICRM_CMSDIR seems to have fixed the URL Variable calculation errors as evidenced . This issue has been bugging me for a long time. Thank you very much. – Tomulent Aug 14 '17 at 23:39
  • I'm pretty certain that I have the same problem: civicrm.stackexchange.com/questions/20888/…. But defining CIVICRM_CSDIR only makes matters worse (duplicating more of [civicrm.root]. I have two servers one live in mysite.org and the other test.mysite.org with all the files in subdirectory test of the live site. I have a quick fix by replacing (by trial and error) [civicrm.root] in the call to CKEditor with wp-content/plugins/civicrm/civicrm. Can you be more specific on what you changed? – Mick Kahn Nov 10 '17 at 17:58

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.