I've acquired a site that is several generations of CiviCRM out of date - currently running 4.0.7.

I'm working through the upgrades and went to 4.1.0 where the new procedure for sending emails is implemented - unfortunately I can't get it to work

I'm trying to run it manually from the command line at the moment. The command I'm using is

php bin/cli.php -s demo1.network-midlands.co.uk -u ***** -p ***** -e Job -a execute

and every time I run it I get the following error

PHP Notice:  Undefined variable: cli in /var/www/vhosts/network-midlands.co.uk/demo1/administrator/components/com_civicrm/civicrm/bin/cli.php on line 30

PHP Fatal error:  Call to a member function callApi() on a non-object in /var/www/vhosts/network-midlands.co.uk/demo1/administrator/components/com_civicrm/civicrm/bin/cli.php on line 30

Lines 28-30 are as follows

$cli = new civicrm_Cli( );
$cli->initialize( ) || die(  );
$cli->callApi( ) || die(  );

it looks like $cli isn't getting defined on line 28 ($cli = new civicrm_Cli( );)

Any clues?. I've since moved up to CiviCRM 4.1.2 to se eif that fixes it but it doesn't.

Note - Joomla is still at version 1.7 - I'm getting as many of the modules as up to date as possible before moving it all to Joomla 3


1 Answer 1


I don't think the problem is what you think it is (on line 28) because otherwise you should get that same notice (and fatal error) on line 29.

There are a whole bunch of bugs submitted on issues.civicrm.org relating to cron in early versions of 4.1. Since CiviCRM 4.2 supports Joomla 1.7, my advice is to upgrade to CiviCRM 4.2.20. Civi 4.2 was a "long term support" release, which means it was getting (some) fixes through April of this year. It should be in far better shape (especially as regards the cron system) than Civi 4.1.2.

  • Thank you - I'll give that a go next time I'm working on the website Commented Sep 2, 2015 at 18:46
  • Well I'm now at civicrm 4.2.20 and I still get the same error message, but now for line 31 PHP Notice: Undefined variable: cli in /var/www/vhosts/network-midlands.co.uk/demo1/administrator/components/com_civicrm/civicrm/bin/cli.php on line 31 PHP Fatal error: Call to a member function callApi() on a non-object in /var/www/vhosts/network-midlands.co.uk/demo1/administrator/components/com_civicrm/civicrm/bin/cli.php on line 31 Any further ideas? Commented Sep 25, 2015 at 14:43
  • I should add that when I click on "execute now" in the scheduled jobs area of CiviCRM, the emails sends fine. Commented Sep 25, 2015 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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