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 »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Setting up scheduled jobs using PHP cli method
Pages: [1]

Author Topic: Setting up scheduled jobs using PHP cli method  (Read 1384 times)

astral1911

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 7.15
  • MySQL version: 5.5.28-cll
  • PHP version: 5.3.17
Setting up scheduled jobs using PHP cli method
February 20, 2013, 07:22:18 pm
I am trying to set up a cron job that will run every 5 minutes to look for all scheduled jobs that are due to run and enabled. 

I am trying to use the php cli method as per the documentation with the following command:
Quote
php -q /home/<myacct>/public_html/sites/all/modules/civicrm/bin/cli.php -u <user> -p <pass> -e Job -a execute
 

I keep getting the following error:
Quote
Warning: require_once(civicrm.config.php): failed to open stream: No such file or directory in /home/<myacct>/public_html/sites/all/modules/civicrm/bin/cli.class.php on line 196

Fatal error: require_once(): Failed opening required 'civicrm.config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/<myacct>/public_html/sites/all/modules/civicrm/bin/cli.class.php on line 196

I am able to run specific jobs individually using the url method, but for some reason I cannot use the command line method.  Seems that it cannot find the civicrm.config.php file. I have verified that the file does exist in the /sites/all/modules/civicrm folder.  What am I missing?

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Setting up scheduled jobs using PHP cli method
February 20, 2013, 11:14:02 pm
Have you tried the drush method to run them? I much prefer it (it's on the wiki page)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Setting up scheduled jobs using PHP cli method
February 21, 2013, 05:35:23 am
Try making the cwd the CiviCRM directory, then you can use the precise syntax of these examples:

http://wiki.civicrm.org/confluence/display/CRMDOC42/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

astral1911

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 7.15
  • MySQL version: 5.5.28-cll
  • PHP version: 5.3.17
Re: Setting up scheduled jobs using PHP cli method
February 21, 2013, 10:22:16 am
Thanks very much for the replies and help.  I am new to Drush so I spent the better part of this morning trying to set it up.  The good news is that I have gotten the Drush command working!!  Jobs now seem to be running as expected. 

However, I am getting a warning when I use the drush command:

Quote
array_keys(): The first argument should be an array Survey.php:996   [warning]
Array
(
    [is_error] => 0
    [version] => 3
    [count] => 1
    [values] => 1
)

But it seems to be running fine.  Is this something to be concerned with?  Sorry, if this is a noob question as I am new to Drush.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Setting up scheduled jobs using PHP cli method
February 21, 2013, 12:54:13 pm

I could not reproduce the notice in either 4.2 or 4.3

If we can reproduce it, we'd definitely like to get this fixed for 4.3

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Setting up scheduled jobs using PHP cli method
February 21, 2013, 01:33:07 pm
If this is your first time using drush you will want to make sure you are familiar with some of the other indespensible drush commands - like 'drush up'
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

idmacdonald

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Setting up scheduled jobs using PHP cli method
March 22, 2013, 11:50:43 am
Hi,

I've had some similar problems with the CLI method. I hadn't realised that there was now a Drush method. I just tried it and it worked like a charm. Thanks Eileen!

Cheers,
-Ian

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Setting up scheduled jobs using PHP cli method

This forum was archived on 2017-11-26.