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 CiviMail (Moderator: Piotr Szotkowski) »
  • civimail cornjob error
Pages: 1 [2]

Author Topic: civimail cornjob error  (Read 4067 times)

BigP

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
Re: civimail cornjob error
August 27, 2010, 12:38:18 am
Drupalcon in Danmark keeps the local guru away..

I tried to work it out myself.

I have set register_argc_argv = false

Now when i run the script via my browser i get the same error as in the previous post.

Warning: require_once(bin/cli.php) [function.require-once]: failed to open stream: No such file or directory in /home/komimo/public_html/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 67

Fatal error: require_once() [function.require]: Failed opening required 'bin/cli.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/komimo/public_html/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 67



statrixbob

  • Guest
Re: civimail cornjob error
August 27, 2010, 01:04:45 am
Quote from: xavier on August 26, 2010, 11:03:47 pm

You should run the cli from the root of your civicrm install, if I understand, you where trying to run it from within the bin ?

Could you try restoring the original file and run it from your civicrm folder, see it solves this warning, and hopefully works directly.

That was it. Thanks. I was tearing my hair out the other day when I absolutely had to get some mail out and just couldn't figure it out.  I've restored everything and it all seems to work fine now. How I got the idea I needed to set to job off from inside the bin directory I'll never know. :-)

Thanks again!

Bob

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civimail cornjob error
August 27, 2010, 03:05:21 am
Quote from: BigP on August 27, 2010, 12:38:18 am
Drupalcon in Danmark keeps the local guru away..

I tried to work it out myself.

I have set register_argc_argv = false

Now when i run the script via my browser i get the same error as in the previous post.

Warning: require_once(bin/cli.php) [function.require-once]: failed to open stream: No such file or directory in /home/komimo/public_html/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 67


It still means that you set argv argc. I think you need to set this within the php.ini or .htaccess

Can we try something else ?

http://www.php.net/manual/en/function.php-sapi-name.php

Could you add an "echo  php_sapi_name()" and see what it reports at the top of the civimail.cronjob.php ?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

BigP

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
Re: civimail cornjob error
August 27, 2010, 03:28:04 am
this is the result:

cgi
Warning: require_once(bin/cli.php) [function.require-once]: failed to open stream: No such file or directory in /home/komimo/public_html/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 69

Fatal error: require_once() [function.require]: Failed opening required 'bin/cli.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/komimo/public_html/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 69

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: civimail cornjob error
August 29, 2010, 10:39:15 am
I'm confused here. The docs haven't changed at http://wiki.civicrm.org/confluence/display/CRMDOC32/Command-line+Script+Configuration nor http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviMail+Installation#CiviMailInstallation-SettingUptheCronJob but it seems that now one is expected to move the PHP scripts out of bin?

I also see that in my 3.2 installs the latest upgrade seems to have broken the wget method and now I see:

Code: [Select]
Usage: $ php5 /sites/all/modules/civicrm/civimail.cronjob.php -u user -p password -s yoursite.org
for cron jobs that worked until this latest upgrade.

Did something change?
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.

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: civimail cornjob error
August 29, 2010, 08:39:33 pm

what errrors do u get with the wget method

invoking via the cli is community contributed and supported (by xavier). for now, we are still using the wget/browser method

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civimail cornjob error
August 30, 2010, 12:04:18 am
Hi,

The cronjobs are supposed to work both on cli & webmode.

The test to determine if it's cli or wget is on the argv/argc variables that are supposed to be set only on cli, but clearly, it isn't the case at least for hershel and BigP.

Apparently, you can also test how the script is called with  php_sapi_name (at least works for BigP). I've tested with it on the attached modified version

Could you tell me if it solves the problem ?

Created an issue:
http://issues.civicrm.org/jira/browse/CRM-6761

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

BigP

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
Re: civimail cornjob error
August 30, 2010, 02:17:13 am
It works for us  ;D

tnx, Xavier

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civimail cornjob error
August 30, 2010, 02:31:24 am
Quote from: hershel on August 29, 2010, 10:39:15 am
I'm confused here. The docs haven't changed at http://wiki.civicrm.org/confluence/display/CRMDOC32/Command-line+Script+Configuration nor http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviMail+Installation#CiviMailInstallation-SettingUptheCronJob but it seems that now one is expected to move the PHP scripts out of bin?

Code: [Select]
Usage: $ php5 /sites/all/modules/civicrm/civimail.cronjob.php -u user -p password -s yoursite.org

I'm changing the error message to make it clearer as well for cli calls (that shouldn't be what you got when using wget):

Code: [Select]
Usage: $cd /your/civicrm/root; $php5 bin/civimail.cronjob.php -u user -p password -s yoursite.org (or default)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: civimail cornjob error
August 30, 2010, 04:56:15 am
Xavier, yes, this is the problem. See here http://drupal.org/node/504510 for the same issue in the Devel module--perhaps the solution there may also be of help.

The version you posted here works for me, too.

Thank you.
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.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civimail cornjob error
August 30, 2010, 06:44:37 am
They added an extra case: if the php used on the shell is php-cgi, they try to use it as a cli.

For us, that's probably better to err on the web site: if you have a proper php-cli, you can benefit from the cli version, otherwise, wget and that's it.

Btw, as you are hosting, you might want to try the cli version, found it that is was less disturbing (using nice -n19) than the regular wget.

Quote from: hershel on August 30, 2010, 04:56:15 am

   if (php_sapi_name() == 'cgi') {
-    return (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0);
+    return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
   }

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

guaka

  • I’m new here
  • *
  • Posts: 29
  • Karma: 1
    • my blog
Re: civimail cornjob error
September 28, 2010, 07:11:22 am
I'm having a similar issue on a CiviCRM install.  cron stopped working from wget after upgrading to 3.2.3.

If I go to http://crm/all/modules/civicrm/bin/civimail.cronjob.php it says "ERROR: You need to send a valid user name and password to execute this file", but when I add user and password parameters it redirects me to http://crm/sites/all/modules/civicrm/bin/civicrm

I suspect this could be due to the setup of the site: the default page for anonymous users is /user and when someone logs in they're redirected to /civicrm - which worked fine with 3.1.5, but stopped working with 3.2.3.

It works from the commandline, in the proper directory, now I'm trying to build something drushy but no luck yet there.

First I got the include error, so I added this to my drush function:  set_include_path(get_include_path() . PATH_SEPARATOR . 'sites/all/modules/civicrm');

But then I got
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=>
    [message] => Console_Getopt: unrecognized option --php
    [mode] => 16
    [debug_info] =>
    [type] => PEAR_Error
    [user_info] =>
    [to_string] => [pear_error: message="Console_Getopt: unrecognized option --php" code=0 mode=callback callback=CRM_Core_Error::handle prefix="" info=""]
)

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: civimail cornjob error
September 28, 2010, 09:32:41 am
I was using wget but when I upgraded it stopped working. all cronjobs and even cornjobs were failing ;)

I thought maybe I had the thing setup wrong so I went and changed it to curl.

Code: [Select]
curl --silent --compressed 'http://domain.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<username>&pass=<password&key=<keyno you can't know it>'
And it works for me now.

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • civimail cornjob error

This forum was archived on 2017-11-26.