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 »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Wordpress $civicrm_root not recognized?
Pages: [1]

Author Topic: Wordpress $civicrm_root not recognized?  (Read 1472 times)

penguintrax

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 2
  • CiviCRM version: 3.3x and 4.x depending on site
  • CMS version: Joomla 1.5 or 1.7 depending on site
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.17
Wordpress $civicrm_root not recognized?
March 11, 2014, 08:44:15 pm
Cron jobs are not running and when I try to execute from URL I get an errror that the CiviCRM root directory is not defined. I get a similar error when trying to upload images in CKEditor.

Code: [Select]
Oops! - The path for including CiviCRM code files is not set properly. Most likely there is an error in the civicrm_root setting in your CiviCRM settings file (/home/fsgnw/public_html/wp-content/plugins/civicrm/civicrm//../civicrm.settings.php).

» civicrm_root is currently set to: .



In civicrm.settings.php the $civicrm_root directory is defined as:

$civicrm_root = '/home/fsgnw/public_html/wp-content/plugins/civicrm/civicrm/';

And the base URL as:

define( 'CIVICRM_UF_BASEURL'      , 'http://www.fsgnw.com/' );


However, in the Resource URLs setting, CiviCRM Resource URL is defined as:

http://www.fsgnw.com/wp-content/plugins/civicrm/civicrm/


I upgraded to 4.4 and the problem doesn't seem to be resolved. What obvious thing am I missing here?
« Last Edit: March 12, 2014, 06:24:05 am by penguintrax »

penguintrax

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 2
  • CiviCRM version: 3.3x and 4.x depending on site
  • CMS version: Joomla 1.5 or 1.7 depending on site
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.17
Re: Wordpress $civicrm_root not recognized?
March 31, 2014, 03:26:14 pm
I ran a clean install of Civi with Wordpress 3.81. Used that settings file to update the faulty install. Still getting the same civicrm_root not defined error.

Can anyone suggest anything else?

douglasjn

  • I’m new here
  • *
  • Posts: 12
  • Karma: 3
Re: Wordpress $civicrm_root not recognized?
April 03, 2014, 06:21:55 pm
Hi,
I was having the same problem you describe on a Wordpress installation with civi 4.4.4. I am no civi expert but the problem seems to be a problem in civicrm.php. I am not sure whether this is the actual problem as I stopped investigating when it worked! In the initialize function on line 280 of civicrm.php the $civicrm_root variable is referenced without first declaring it a global variable. I just stuck a line in at the beginning of the function like this:

Code: [Select]
public function initialize() {
    global $civicrm_root;
    static $initialized = FALSE;
    static $failure = FALSE;

It seems to work for me - crons all working. Hope this helps.

Cheers,
Douglas.

penguintrax

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 2
  • CiviCRM version: 3.3x and 4.x depending on site
  • CMS version: Joomla 1.5 or 1.7 depending on site
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.17
Re: Wordpress $civicrm_root not recognized?
April 04, 2014, 06:58:57 am
Douglas,

I could KISS you, lol! That worked. I wonder if you should submit it as a patch and have the core team review it, but for me, that seems to have solved the problem.

Once the patch is approved, it should probably be referenced in the Wordpress Installation documentation for Civi.

Barbara

pcoutas

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.4.5
  • CMS version: WordPress 3.9.1
  • MySQL version: 5.5.32
Re: Wordpress $civicrm_root not recognized?
June 28, 2014, 06:16:07 pm
I just upgraded to 4.4.5 and was encountering the same error. This fix also resolved it! :)

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Wordpress $civicrm_root not recognized?
June 30, 2014, 08:42:34 am
Have created a pull request here: https://github.com/civicrm/civicrm-wordpress/pull/44

Thanks for debugging!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Wordpress $civicrm_root not recognized?

This forum was archived on 2017-11-26.