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 »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
Pages: [1]

Author Topic: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]  (Read 4053 times)

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 27, 2011, 01:31:15 pm
I believe I finally got the EmailProcessor.php file working.  It now connects successfully to a POP3 email account I have set up (though not one hosted on google apps, which I couldn't get working).  The status responds:

Code: [Select]
connecting to example.com and authenticating as bounce@example.com got to the end of the mailbox
I think this means I'm in good shape.

Onto problem 2: I can't get civimail.cronjob.php to work.

When I go to the url, http://example.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=myuser&pass=mypass&key=mykey, I get the following error:

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

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

Any help would be appreciated.  I have access to shell, so ideally I'd like to set it up that way, but I'm a noob at this stuff and I've found the documentation to be confusing so far. I just can't get stuff working.

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.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 27, 2011, 01:52:56 pm
what web server are you using? is this a fast cgi version?

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

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 27, 2011, 02:02:26 pm
Webserver: Apache 2.2.17 (its on hostgator)

Don't know what you mean by fast cgi version.

This is the shell output from php -v:

$ php -v
PHP 5.2.15 (cli) (built: Dec 15 2010 12:26:49)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by ionCube Ltd., and
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
« Last Edit: January 27, 2011, 02:04:29 pm by CaseyE »

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.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 27, 2011, 02:10:41 pm
could you try the cli version as described in the book instead of wget?

I think I know what it is. Could you fill an issue and assigh it to me?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 27, 2011, 02:27:17 pm
Its the damnedest thing, it just started working.  Accessing the script via my browser still does not work (i.e., going to http://example.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=myuser&pass=mypass&key=mykey still results in the error I posted earlier), but if I run the following command in my shell it works fine:

Code: [Select]
php bin/civimail.cronjob.php -sdefault -umyusername -pmypassword
Perhaps I did something (changing file permissions maybe?) that made it work this time and not before.  I've spent like 15 hours trying to get this to work... hopefully now all I have to do is set up cron and it will be good.

Thank you for your help!

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 27, 2011, 02:39:09 pm
Now that that part is working, would you mind helping with my bounce processing?

My current settings are as follows:

MAIL ACCOUNTS:
Name: default
Server: myserver.com
username: bounce@myserver.com
password: mypassword
Localpart: blank (my server doesn't support this)
Email Domain: myserver.com
Return-Path: blank (don't know what to put here - manual says leave it blank)
Protocol: POP3
Source: Blank
Use SSL: no
Used For?: Bounce processing

I added a bademailaddress@mydomain.com to my mailing list and sent out the mailing list.  Nothing showed up in the inbox for bounce@myserver.com, and civicrm reports it was delivered successfully. I'm assuming I need something for Return-Path, but I have no idea what to put.

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 30, 2011, 02:14:31 pm
I set this up using my google apps email account... the port needed to be opened.  It works now.

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 31, 2011, 10:58:53 am
This is driving me crazy... civimail.cronjob.php no longer works.

I am trying to send a newsletter to a group of two addresses: one to my email address, and one to a bogus email address to test bounce processing.  When I process the queue by visiting http://example.org/civicrm/mailing/queue&reset=1 it works fine and sends out the email.  When I try to run the process through ssh, it fails silently (it looks like it completed, but I never get my email).

I am using the following commands in shell to execute this process:

Code: [Select]
cd SITE/sites/all/modules/civicrm/
php bin/civimail.cronjob.php -sdefault -umyusername -pmypassword

It appears to work fine... the status in the "sent newsletters" lists a time completed shortly after I execute the script, and it lists "successful deliveries as 2 (100%)".

If I investigate the log, however, it says:

Code: [Select]
[31-Jan-2011 08:32:22] PHP Warning:  require_once(bin/cli.php): failed to open stream: No such file or directory in /home/USER/SITE/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 70
[31-Jan-2011 08:32:22] PHP Fatal error:  require_once(): Failed opening required 'bin/cli.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/USER/SITE/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 70
[31-Jan-2011 08:32:54] PHP Warning:  require_once(bin/cli.php): failed to open stream: No such file or directory in /home/USER/SITE/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 70
[31-Jan-2011 08:32:54] PHP Fatal error:  require_once(): Failed opening required 'bin/cli.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/USER/SITE/sites/all/modules/civicrm/bin/civimail.cronjob.php on line 70

I've tried this several times, so I believe that each one of these log entries is either one per email address, or one per time I ran the script.

Any ideas as to why this is happening and how to fix it?

Also: every script in bin/ has permissions of 755.

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.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 31, 2011, 12:44:46 pm
?!?

Just to be sure: you do have bin/cli.php under your sites/all/modules/civicrm ?

Doesn't make sense to me. And the bin/civimail.cronjob.php should die with the error message instead of running silently anyway.

What's the log you are displaying ?

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

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 31, 2011, 12:52:39 pm
Hi xavier,

cli.php is under /SITE/sites/all/modules/civicrm/bin. It has permissions of 755, not sure how to check the owner.

When I run it in shell, it looks like it completes but never sends the emails out.  I tried adding some print statements to the processQueue function, and it shows that it completes that function.  Problem is, I never get the email.  If I visit the http://example.org/civicrm/mailing/queue&reset=1 webpage, it works fine (I get the email).

I have determined that the log entries are from me visiting http://example.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=myuser&pass=mypass&key=mykey in my web browser (those errors are also displayed in my browser window).  I don't know if the two issues are separate or linked.

Thanks for your help.
« Last Edit: January 31, 2011, 12:54:23 pm by CaseyE »

planigan

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
    • Allegheny CleanWays
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 6.24
  • MySQL version: 5.0.90
  • PHP version: 5.2.13
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 31, 2011, 09:10:53 pm
I now have a similar issue. The civimail.cronjob.php completes without errors, and the mailing status changes to "Running" with the expected time listed in the "Started" column at http://example.org/civicrm/mailing/browse/scheduled.

However, the mailing doesn't actually get sent -- and the "Completed" column does not get filled in -- until I manually browse to http://example.org/civicrm/mailing/queue&reset=1

One thing to look at if you are still getting require_once(bin/cli.php) errors is the difference between php interpreters. Check my previous thread for more info on that (http://forum.civicrm.org/index.php/topic,18395.0.html).

Not sure if these issues are related or not though  ???

planigan

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
    • Allegheny CleanWays
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 6.24
  • MySQL version: 5.0.90
  • PHP version: 5.2.13
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
January 31, 2011, 09:30:42 pm
OK, I finally solved the issue for good. My problem was making sure that the cron Drupal user has "Edit All Contacts" permissions. Why it needs that permission is beyond me. Solution was found in this thread: http://forum.civicrm.org/index.php/topic,15472.0.html

So, to sum up there were two issues that needed to be addressed:

1) The php executable that was being run by crontab was built using the CGI SAPI, and so changed the working directory to that of the civimail.cronjob.php script (which was bad, because that script expects to be run from the civimail root).
2) The Drupal user passed using the -u argument to the civimail.cronjob.php script needs to have "Edit All Contacts" permission, as well as "Access CiviCrm" and "Access CiviMail".

Hope this helps!


CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
February 01, 2011, 02:01:05 pm
This is so strange... it is suddenly working again.

I was using my superadmin account (that did not have any privs explicitly checked in Drupal, but because it is a superadmin account it doesn't matter) to initiate civimail.cronjob.php in terminal.  I added the privileges you suggested and then suddenly it worked!  I thought I figured out the problem, so I unchecked all the privileges again and it still worked!  I am completely dumbfounded as to what the problem is.

Its sort-of working now... coming up with a cron error that I think you experienced, but I'm going to take a look at that now.

Thanks for the help!

planigan

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
    • Allegheny CleanWays
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 6.24
  • MySQL version: 5.0.90
  • PHP version: 5.2.13
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
February 01, 2011, 02:53:57 pm
No problem, let me know how it works out for ya. So far everything seems resolved on my end.

CaseyE

  • I’m new here
  • *
  • Posts: 28
  • Karma: 0
    • Logic Bloc
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.52
  • PHP version: 5.2.4
Re: civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]
February 03, 2011, 08:53:33 am
Hi planigan,

Thanks for the tip.  My host wrote a little script for me that I can call from cron.  At first it wasn't working from cron (yet it was from the terminal).  This was caused by the CGI SAPI thing you were talking about.

Here's the working cron script, in case anyone else finds it useful:

Code: [Select]
#! /bin/sh

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

cd /home/USER/SITE/sites/all/modules/civicrm;

nice -n 19 php \
bin/civimail.cronjob.php \
-sdefault \
-uDRUPAL_USER_NAME \
-pDRUPAL_PASSWORD


cd /home/USER/SITE/sites/all/modules/civicrm; should be the full path to your civicrm directory, and replace DRUPAL_USER_NAME and DRUPAL_PASSWORD with your mailprocess drupal user account.

Thanks for your help!
« Last Edit: February 03, 2011, 08:57:11 am by CaseyE »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • civimail.cronjob.php fails; require_once(bin/cli.php) [function.require-once]

This forum was archived on 2017-11-26.