[how to] get phplist working with cpanel cron

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

Re: [how to] get phplist working with cpanel cron

Postby Bobendren » 11:07am, Fri 22 Oct, 2010

Thanks! I'm sure you've saved me hours of headaches. It worked first shot surprisingly.

I do have a question though...you say to add " >/dev/null " on the end of the command to stop receiving the notifications, but in cpanel, it suggests adding this code on the end to do the same thing: " >/dev/null 2>&1 "

What does the extra " 2>&1 " do?
Bobendren
phpList newbie
 
Posts: 1
Joined: 10:55am, Fri 22 Oct, 2010

Re: [how to] get phplist working with cpanel cron

Postby sarxeg » 12:18am, Thu 11 Nov, 2010

Hi ,
It's easy just go on cpanel to

Advanced > Cron Jobs :

and type for Process Queue (each 5 minutes):


*/5 * * * * /usr/local/bin/php /home/CPANEL_USERNAME/public_html/lists/admin/index.php -p processqueue > /dev/null


For process Bounces (once an hour) :

0 * * * * /usr/local/bin/php /home/CPANEL_USERNAME/public_html/lists/admin/index.php -p processbounces > /dev/null

Also on config.php file change :

# if you use commandline, you will need to identify the users who are allowed to run
# the script. See README.commandline for more info
$commandline_users = array("CPANEL_USERNAME");
# or you can use the following to disable the check (take off the # in front of the line)
# $commandline_users = array();


That's It
:D
sarxeg
phpList newbie
 
Posts: 2
Joined: 12:10am, Thu 11 Nov, 2010

Re: [how to] get phplist working with cpanel cron

Postby LOUM » 2:24am, Wed 24 Nov, 2010

Hi gang!
JUST a word to say that in my case, setting CRON was done in minutes after reading the tutorial by CROWDOFONE. A big THANK! to all of you who take time to write help post and tutorials so people like me can get that wonderful phplist-program running fine and smooth.
LOUM
phpList newbie
 
Posts: 1
Joined: 2:14am, Wed 24 Nov, 2010

Re: [how to] get phplist working with cpanel cron

Postby rjohnsonsc2 » 5:42pm, Fri 17 Dec, 2010

I am seriously struggling to get my Cron jobs to work in Cpanel. I have tried everything this forum has to offer and I have no such luck. I am a reseller for Hostgator and and I have PHPList installed on my primary domain on my server. Every string I try for the Cron Job isn't working. Can someone please help???? I am running the latest version of PHPList.

cPanel Version 11.28.52
Theme x3
Apache version 2.2.16
PHP version 5.2.11
MySQL version 5.1.52
PHPList Version 2.10.12
rjohnsonsc2
phpLister
 
Posts: 5
Joined: 1:24am, Thu 07 Oct, 2010
Location: Anderson, SC

Re: [how to] get phplist working with cpanel cron

Postby rjohnsonsc2 » 8:20pm, Wed 22 Dec, 2010

I finally got my cron job to work inside of Cpanel....
rjohnsonsc2
phpLister
 
Posts: 5
Joined: 1:24am, Thu 07 Oct, 2010
Location: Anderson, SC

Re: [how to] get phplist working with cpanel cron

Postby sspitfire » 8:03pm, Sat 22 Jan, 2011

/usr/local/bin/php /home/mysiteusername/public_html/lists/admin/index.php -pprocessqueue -c/home/mysiteusername/public_html/lists/config/config.php

I tried this and I get message from cron : /bin/sh: usr/bin/php: No such file or directory

My PHP path is usr/bin/php - I checked it. Im on hostgator

Any ideas why is that ?
sspitfire
phpLister
 
Posts: 9
Joined: 4:12pm, Sat 22 Jan, 2011

Re: [how to] get phplist working with cpanel cron

Postby KikiEss » 4:55pm, Wed 30 Mar, 2011

Hey sspitfire

I'm on hostgator also. Forget about the "/usr/bin/php" and just put "php" . BTW, this is the solution that worked for me.

1. Set up a new admin in phplist with every permission set to "All".
2. Since you're on Hostgator, make sure your phplist config.php file has the correct settings:

Change:
Code: Select all
# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",0);

# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',0);


to
Code: Select all
# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",0);

# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",3600);

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',8);


(This wil keep your emails at around 450 per hour; Hostgator's limit is 500)



Also, Change
Code: Select all
# if you use commandline, you will need to identify the users who are allowed to run
# the script. See README.commandline for more info
$commandline_users = array("");
# or you can use the following to disable the check (take off the # in front of the line)
# $commandline_users = array();


to
Code: Select all
# if you use commandline, you will need to identify the users who are allowed to run
# the script. See README.commandline for more info
# $commandline_users = array("PHPLIST_ADMIN_USERNAME");
# or you can use the following to disable the check (take off the # in front of the line)
$commandline_users = array();




... and make sure
Code: Select all
define ("TEST",0);

is set to 0.

3. Finally, click on Cron Jobs in the Cpanel. In the "Add New Cron Job" section, click on common settings and choose "Once an hour". Then in the command section type:
php /home/CPANEL_USERNAME/public_html/PHPLIST_FOLDER/admin/index.php page=processqueue login=PHPLIST_ADMIN_USERNAME password=PHPLIST_ ADMIN_PASSWORD > /dev/null



Hope that helps :-)
KikiEss
phpList newbie
 
Posts: 1
Joined: 4:47pm, Wed 30 Mar, 2011

Re: [how to] get phplist working with cpanel cron

Postby openmtl » 7:18pm, Tue 31 May, 2011

There is a little problem (on some hosts, if not all hosters) if you pass a username and password to php-cgi in that this could be put into email messages as the X-Source-Args: parameter.

e.g. if your cron job is,

/usr/bin/php-cgi -c /home/myname/public_html/lists/admin/php.ini /home/myname/public_html/lists/admin/index.php page=processqueue login=myloginname password=mypassword

then your subscribers will see all that as the X-Source-Args including the username and password. Yup you've just sent your queue username and password to all your subscribers.

The trick is to NOT send this via the command line but use some new environment variables.

This is what I did.... (on EUKHost reseller Linux).

My cron job is very simple in Cpanel,

/home/myname/etc/domain.name/runmqueue.sh

I set it to permissions 700

Inside this file I have,

Code: Select all
#/bin/bash
export PHPCGILOGIN="myphplistloginname"
export PHPCGIPASSWORD="myphplistpassword"
export PHPCGITASK="processqueue"
/usr/bin/php-cgi -c /home/myname/public_html/lists/admin/php.ini /home/myname/public_html/lists/admin/index.php page=$PHPCGITASK   >/dev/null


then you MUST edit the /lists/admin/index.php and around line 177 just before it checks for the $_REQUEST for login and password you must add in the two lines...

Code: Select all
if (isset($_ENV["PHPCGILOGIN"])) { $_REQUEST["login"] = $_ENV["PHPCGILOGIN"]; }
  if (isset($_ENV["PHPCGIPASSWORD"])) {$_REQUEST["password"] = $_ENV["PHPCGIPASSWORD"]; }


That's all. Now when the admin/index.php runs in php-cgi mode then you can pass it the username and password via the environment rather than the command line and so these details will not appear in X-Source-Args: if your hosting provider inserts those.

In PHPLIST you really must define a separate user to process the queue/bounces for just this kind of leakage of passwords. This is easy to do - go into phplist administration and admins and add an admin that only has,

message processqueue
system processbounces

If someone does get your queue user password then they can't really do much damage at all.
openmtl
phpList newbie
 
Posts: 2
Joined: 7:03am, Fri 30 Jan, 2009

Re: [how to] get phplist working with cpanel cron

Postby elalcaudon » 1:49pm, Mon 13 Jun, 2011

First would suggest you check that cron is correctly setup to email you each time it runs.

Without this notification you will find it hard to ascertain any phplist related issues.
elalcaudon
phpList newbie
 
Posts: 2
Joined: 1:33pm, Mon 13 Jun, 2011

Re: [how to] get phplist working with cpanel cron

Postby Shaman2 » 10:28am, Mon 05 Sep, 2011

Shaman2
phpList newbie
 
Posts: 4
Joined: 9:24pm, Sun 04 Sep, 2011

Re: [how to] get phplist working with cpanel cron

Postby sstowell » 12:17am, Fri 30 Sep, 2011

My mailing list batch processing that has worked fine (well OK recently :-) for a over a years now now has a problem:

The first batch goes out fine, but I am not sure the second batch ever gets sent (to complicate matters I just discovered my user record got marked unconfirmed at some point, so I would not get the newsletter anyway...!)

I process the queue in a browser window, with my 660 member list going out in (2) 350 user batches an hour apart.

But the last three mailings, I walked away from my computer after the first batch sent, and came back in the morning to see no further progress listed, and the "do not close window" message. Used to see the status of the second batch completed.

So I am trying to set up a cron job, hoping this would be better BUT I can't get past a phplist usage error:

phpList version 2.10.17 (c) 2000-2011 phpList Ltd, http://www.phplist.com
Usage: /home/northwi/public_html/memberlist/admin/index.php -p page [other parameters]


Cron job:

/usr/local/bin/php /home/northwi/public_html/memberlist/admin/index.php -pprocessqueue -c/home/northwi/public_html/memberlist/config/config.php


I have tried this with & w/o spaces after "-p" & "-c", w/o the "-c" at all, w & w/o login & password (with the corresponding config.php entries).

Never get past the same usage message, so I am overlooking something basic: HELP will be appreciated!
sstowell
phpLister
 
Posts: 14
Joined: 4:49pm, Wed 14 Oct, 2009

Re: [how to] get phplist working with cpanel cron

Postby Renik » 10:30am, Sun 16 Oct, 2011

I have a problem with this. In my cPanel I can add only cron in the form http://www.domain.sk/script.php
If I add http://www.domain.sk/subscribe/admin/index.php page=processqueue login=MY_LOGIN password=MY_PASS
I get error.. Any solution? :(
Renik
phpLister
 
Posts: 12
Joined: 9:33am, Sun 16 Oct, 2011

Re: [how to] get phplist working with cpanel cron

Postby rangerdj » 6:18pm, Wed 02 Nov, 2011

I am having an issue with my host gator phplist process message queue cron job.

Here is the cron job.

php /home/bsi001/public_html/emaillist/admin/index.php -p processqueue login=username password=mypassword -c /home/bsi001/public_html/lists/config/config.php

The cron job executes, but doesnt process the message queue. The email reply I receive from the cron job is the html code of the index page asking for a username and password.
I am passing the proper username and password in the cron job command line.

Can anybody help me figure out what he problem is?

Thanks

DJ
rangerdj
phpList newbie
 
Posts: 3
Joined: 4:34pm, Thu 27 Oct, 2011

Re: [how to] get phplist working with cpanel cron

Postby sstowell » 9:15pm, Wed 02 Nov, 2011

I have never solved my cron job issues, and no solutions have been suggested. So I can't really help.

It seems likely that cron does not get the arguments we are sending it on the command line. I have tried using quotes without success, and I don't know what shell is processing the command line on my host server.
sstowell
phpLister
 
Posts: 14
Joined: 4:49pm, Wed 14 Oct, 2009

Re: [how to] get phplist working with cpanel cron

Postby duncanc » 10:29am, Thu 03 Nov, 2011

rangerdj wrote:I am having an issue with my host gator phplist process message queue cron job.

Here is the cron job.

php /home/bsi001/public_html/emaillist/admin/index.php -p processqueue login=username password=mypassword -c /home/bsi001/public_html/lists/config/config.php

You are mixing syntax for php cli and php cgi. As you are getting back an HTML page then you have php cgi installed, so see this topic for the command to use
http://forums.phplist.com/viewtopic.php?f=6&t=24643
duncanc
Moderator
 
Posts: 2440
Joined: 6:34am, Sat 08 May, 2010
Location: London

PreviousNext

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron