3

I upgraded to 4.7.14 and now I get the following error when running /wp-content/plugins/civicrm/civicrm/bin/cron.php. I'm running Wordpress 4.7.

Fatal error: Uncaught exception 'Exception' with message 'Function "is_admin()" is missing, even though WordPress is the user framework.' in /home/mysite/www/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php:261 Stack trace: etc

This is similar to the post Cron error after upgrade to 4.7.1.

cron has been running fine for years previously - on the same host

I'm trying to run:

GET 'http://mysite.com.au/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=admin&pass=somepassword&key=sitekey'

I can run the jobs manually from the scheduled jobs screen and they complete

I've tried:

  1. cli and URL versions
  2. changing permissions for cron.php and cli.php
  3. confirmed no special characters in password or site key

That's about the extent of my capabilities sadly.. Any suggestions please?

2

The error message comes from here and indicates that cron.php is not bootstrapping the WordPress CMS, so WordPress functions aren't available.

WordPress is_admin() is defined in wp-includes/load.php. If WordPress was initialised, that function would be present.

If you are able to configure your cron to execute via commandline (eg wp-cli method or PHP CLI method) instead of by request to cron.php, that might give you a workaround for whatever issue is affecting this setup. (Edit: Oh, you tried that? Sorry!)

There was a previous report (from 2012) of the same behaviour: CRM-9727: cron.php will not run in Wordpress, is_admin() call to undefined function.

  • thanks: I had a look at the issue but to be honest nothing actually seemed to happen to resolve it - and it was a long time ago now. Is it a realistic possibility that its a Wordpress plugin? Ive not changed anything - except this update and cron's been working fine for years – Robinnz Dec 18 '16 at 23:25
  • If a WordPress plugin was loaded, then I'd expect is_admin() to be available. So my read of that is that it shouldn't be a WordPress plugin causing this. – Chris Burgess Dec 19 '16 at 0:03
1

well its fixed ..sort of

I was advised to use WP-CLI and that got Cron running.. but still dont know why the URL method was failing

dodgy Wordpress plug in? who knows...

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.