1

Really getting frustrated trying to get cron to work.

WP 4.7 / CiviCRM 4.7.14

using via ssh:

/usr/bin/wget 'https://hbb.org.uk/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=JohnB&pass=123&key=456'

Generates the error.

my settings.php has:

if (!defined('CIVICRM_SITE_KEY')) { define( 'CIVICRM_SITE_KEY', '456'); }

Where the two keys are identical. There are no special characters, it's a 20 char string, I've re-entered a new string into both settings.php and the wget. Each time generates a new error log file with the msg.

When I enter the url into Chrome I get "Invalid key". Yet they're identical in the wget and settings.php.

Is there some super-sekret settings file somewhere?

0

Site key should be defined in civicrm.settings.php, not settings.php, which isn't necessarily bootstrapped when cron is run.

If that was mis-stated in your question (likely, since you're using WordPress), you can try to troubleshoot this by debugging.

  • Find your CiviCRM log and your CiviCRM root.
  • In your CiviCRM root, find the file CRM/Utils/System.php.

  • Find this section (around line 553):

    if ($key !== $siteKey) {
      return self::authenticateAbort(
        "ERROR: Invalid key value sent. " . $docAdd . "\n",
        $abort
      );   
    }  
    
  • Add two debugging lines so that section now looks like:

    if ($key !== $siteKey) {
      CRM_Core_Error::debug_var('key', $key);
      CRM_Core_Error::debug_var('siteKey', $siteKey);
      return self::authenticateAbort(
        "ERROR: Invalid key value sent. " . $docAdd . "\n",
        $abort
      );   
    }  
    
  • Run your cron job again, get the same error.

  • Check the CiviCRM log. At or very near the bottom of the log file, you should see lines that look like:

    $key = 456;
    $siteKey = 456;
    

...except I'm guessing that one of them looks slightly wrong! Use that information to either fix this problem and/or update this question with more info.

  • Don't forget to remove those last two lines when you're done! – Jon G - Megaphone Tech Jan 12 '17 at 2:13
  • Yes, sorry, my laziness 'CIVICRM_SITE_KEY', '456' is defined in civicrm.settings.php – John Bradford Jan 12 '17 at 19:46
  • Weirdly error files are being saved in the domain home so I've public_html & subdomains folders .bash_history .bashrc .htaccess and then a cron.php?name=JohnB&pass=123&key=456.28 - the 28 referring to the other 27 copies as I left cron running to see what would happen :-) they all have the same content: ERROR: Invalid key value sent. More info at:wiki.civicrm.org/confluence/display/CRMDOC/… – John Bradford Jan 12 '17 at 19:49
  • CiviCRM.5ea62a755e1d78acd0439277.log (my latest log file) doesn't appear to have those 2 lines anywhere: it's failing and generating a bucket load of error msg's but mostly around shortcodes (and the time stamps don't match the cron trigger) so something else needs looking at. :( – John Bradford Jan 12 '17 at 19:56
  • ok may have just spotted the deliberate error - just above the if ($key !== $siteKey) { is a line : $siteKey = defined('CIVICRM_SITE_KEY') ? CIVICRM_SITE_KEY : NULL; will try changing NULL to the value in civicrm.setting.php – John Bradford Jan 12 '17 at 20:13

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.