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) »
  • 1.8 civimail.cronjob.php needs authentication - help please
Pages: [1]

Author Topic: 1.8 civimail.cronjob.php needs authentication - help please  (Read 7713 times)

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
1.8 civimail.cronjob.php needs authentication - help please
August 30, 2007, 06:45:54 pm
I have just come to understand that the 1.8 version of the civimail.cronjob.php file which is to be called by cron now requires authentication with the inclusion of this single additional line to the file in 1.8.

    CRM_Utils_System::authenticateScript( true );

Currently the command is: cd /home/mydomain/public_html/sites/all/modules/civicrm/; php civimail.cronjob.php > /dev/null 2>&1

I need some help to understand how to include authentication in the crontab that calls civimail.cronjob.php.  Does anyone know how to do this?

many thanks
-dave

« Last Edit: September 10, 2007, 05:52:29 am by karunadave »

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: 1.8 civimail.cronjob.php needs authentication - help please
August 30, 2007, 08:17:40 pm

You can use either wget or curl. Both should be available on your system, if not, check with your hosting provider

// For Drupal installs - replace <drupal_root> with the base URL of your Drupal site
$ wget http://<drupal_root>/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<username>&pass=<pw>

send in the username/pw from a valid drupal account.

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

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
Re: 1.8 civimail.cronjob.php needs authentication - help please
September 02, 2007, 10:09:46 am
I am having some odd trouble with this, with cron. 

If I use this in a URL in a browser then there is no error and the queue is processed:
Code: [Select]
http://<drupal_root>/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<username>&pass=<pw>

If I use it in cron - with wget- it produces an error '/bin/sh: /usr/bin/wget: Permission denied' 
Code: [Select]
wget http://<drupal_root>/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<username>&pass=<pw>
If I use the wget syntax for account and password I get the same error.
Code: [Select]
wget --user=<username> --password=<pw> http://<drupal_root>/sites/all/modules/civicrm/bin/civimail.cronjob.php
If I roll back the civimail.cronjob.php to version 1.7, which does not require authentication, then all the above cron commands also produce the same error.  "/bin/sh: /usr/bin/wget: Permission denied"

Does anyone have any ideas?

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: 1.8 civimail.cronjob.php needs authentication - help please
September 02, 2007, 11:52:10 am

What happens when you run:

wget http://<drupal_root>/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<username>&pass=<pw>

If you still get:

/bin/sh: /usr/bin/wget: Permission denied

contact your hosting provider and ask them what you need to do to get around the above permission. In either case, you will need to talk to your hosting provider

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

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
Re: 1.8 civimail.cronjob.php needs authentication - help please
September 07, 2007, 01:22:32 pm
For my host Site5, a special request must be made to use wget in a crontab.  Once this was allowed I am no longer getting a permission denied message.

However, I notice that the civimail.cronjob.php is not picking up my civicrm.settings.php file, (which I have in drupalroot/sites/www.mysite.org), I have to have this file in the drupalroot/sites/default directory. 

I guess this is part of the reason whey CiviMail does not support Drupal Multisites functionality. 

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: 1.8 civimail.cronjob.php needs authentication - help please
September 07, 2007, 01:28:48 pm

Check:

http://forum.civicrm.org/index.php/topic,965.msg4093.html#msg4093

to make civicrm multisite aware

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

msn

  • I post frequently
  • ***
  • Posts: 152
  • Karma: 6
  • Please talk to the other site
Re: 1.8 civimail.cronjob.php needs authentication - help please
September 07, 2007, 05:26:28 pm
I am a site5 user too and have a drupal multiside on site 5.
Wget does not work on site5

I solved this issue with a php script, look at: http://forum.civicrm.org/index.php/topic,793.0.html

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
Re: 1.8 civimail.cronjob.php needs authentication - help please
September 10, 2007, 08:03:07 am
Quote from: msn on September 07, 2007, 05:26:28 pm
I am a site5 user too and have a drupal multiside on site 5.
Wget does not work on site5

I solved this issue with a php script, look at: http://forum.civicrm.org/index.php/topic,793.0.html

Hello fellow Site5 user!

I am trying your approach but have not yet succeeded.  I am wondering if you could be a second set of eyes.

Here is what I am doing.

1. created a file called civimailcron.php and placed it one directory above public_html at /home/mysite/civimailcron.php

2. given the file permissions 755

3. the content of the file is as below. Note that this URL (when made specific to my domain account and password) does cause the mail queue to process.
Code: [Select]
<?php                                                                                                                               
@include("http://www.mysite.com/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=drupalaccount&pass=drupalaccountpassword");
?>

4. defined a crontab
Code: [Select]
3,18,33,48 * * * * cd /home/mysite/; /usr/local/php5/bin/php5 civimailcron.php
5. receive from the cron daemon an email message
Code: [Select]
X-Powered-By: PHP/5.2.0
Content-type: text/html

However, the mail queue is not processed. (although URL in the civimailcron.php file does process the queue when called directly in a browser.

Any ideas what I may be missing?

msn

  • I post frequently
  • ***
  • Posts: 152
  • Karma: 6
  • Please talk to the other site
Re: 1.8 civimail.cronjob.php needs authentication - help please
September 10, 2007, 11:58:20 am
The solution on http://forum.civicrm.org/index.php/topic,793.0.html works for me on side5 with drupal in multisite setup.
When I read your setup, it is not the same ..

What I did:
1:
I made a folder named ' scripts ' in my domain root (unther the public_html level). It is the same level as the public_ftp and public_html folders.

2:
I made a file named civimailcron.php with the content

Code: [Select]
<?php
@include("http://www.website.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=drupal_login_name&pass=drupal_login_pass");
?>
And I placed this file in the folder 'scripts'.  (file perm 755)

3:
In cron I made the command: 
Code: [Select]
php ~/scripts/civimailcron.php


Expl:
Cron:
the first php is for telling cron a php script is following
~ in cron is domain root (your user domain name in site5) (not server root!!)
cron runs the file ~/scripts/civimail.php

The file civimail.php runs civimail.cronjob.php wich is part of your civicrm installation. When you did a correct civicrm install it is in the drupal map: sites/all/modules/civicrm/bin/. Because the script is based on a websitename (http://www.website.org....) it only affect this website and it can be used in multiside environment. A script from server root (/home/mysite/) or domain root wil only affect the main drupal domain (drupal default)

Because civimail.php is unther public level (public_html) the content of this file is safe (drupal username end password)

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
Re: 1.8 civimail.cronjob.php needs authentication - help please
September 11, 2007, 08:34:47 am
Quote from: msn on September 10, 2007, 11:58:20 am

1:
I made a folder named ' scripts ' in my domain root ... same level as the public_ftp and public_html folders.

2:
I made a file named civimailcron.php with the content

Code: [Select]
<?php
@include("http://www.website.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=drupal_login_name&pass=drupal_login_pass");
?>
And I placed this file in the folder 'scripts'.  (file perm 755)

3:
In cron I made the command: 
Code: [Select]
php ~/scripts/civimailcron.php

Putting these files in ~/scripts is a tidy way to do things, thanks.  I have moved my imap2soap.pl and imap2soap.conf there too.

Another thing that I had done was to try to force the use of PHP5 on Site5 (which is still PHP4.4 by default) by invoking PHP with '/usr/local/php5/bin/php5' rather than 'php' in the crontab.  Going back to simple 'php' in the crontab works fine, and this is because the actual execution of the civimail.cronjob.php file is done by URL which means that the .htaccess file directive 'AddHandler application/x-httpd-php5 .php' takes effect.

In any event these modifications now results in the mail queue now being processed.  Yipee!!!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • 1.8 civimail.cronjob.php needs authentication - help please

This forum was archived on 2017-11-26.