[how to] make phplist work with Cron Jobs

Solutions for other advanced phplisters

Solution worked?

Yes
17
30%
No
14
25%
Still working on it
26
46%
 
Total votes : 57

Documentation on cron jobs and commandline script

Postby H2B2 » 5:09am, Sat 21 Oct, 2006

I've just added a few pages to the documentation wiki you might consult when setting up a commandline script and/or cron job:

- Using a commandline script
- Setting up cron jobs
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby Julianna » 1:38am, Sat 27 Jan, 2007

Hi.

I have tried the different options in this post and several of the ones in referenced posts. The closest I can get is either the html output others have gotten or a report saying "You ([CPanel username]) do not have sufficient permissions to run phplist on commandline"

Any insights?

Thanks.
Julianna
PL Nut
 
Posts: 25
Joined: 10:28am, Mon 15 May, 2006

Re: success on 2.9.4 - need to set USER environment variable

Postby Julianna » 1:16pm, Sat 27 Jan, 2007

I finally got it to work for me!

For reference, I am using CPanel and this is what I did:

1. Rename the /bin/phplist file to /bin/phplist.txt (CPanel doens't like running files without an extension).
2. Update the /bin/phplist.txt file to reference the paths for my server.
3. Upload the updated phplist.txt file to the /bin folder
4. Added the following code to my config.php file, and used my CPanel username as one of the comandline users (i.e. replaced what was in the quotes with the actual CPanel username).
Code: Select all
$commandline_users = array("cpanel username");

5. Upload the updated config.php file
6. Log into the CPanel interface and created a cron tab (in the Standard editor, so I could more easily select timing) with the following in the command to run:
Code: Select all
/path/to/bin/phplist.txt -p processqueue



Here is the original post I used to get this working:
Cafamily wrote:I got cron jobs to work on 2.9.4 so i thouht I'd report what I did and make a couple of comments on the original post by Daniela (which was helpful)...

1. why create a script called "phplist" if you're not going to use it? The cronjob line given runs the /lists/admin/index.php directly so the phplist file is superfluous unless you use that ( as I have ).

2. with 2.9.4 a MAILQUEUE_THROTTLE variable exists in the config file so I used that, my settings are :

Code: Select all
define("MAILQUEUE_BATCH_SIZE",200);
define("MAILQUEUE_BATCH_PERIOD",3600);
define('MAILQUEUE_THROTTLE',5);


this will send a message every 5 seconds, batching no more than 200 message per hour. This is fine for us as we have 800+ subscribers and two lists.

3. with 2.9.4 (at least) a phplist file is included in the download - it's under the bin directory. I relocated this to a location away from my public html files ( say /usr/local/cron_scripts ) and point to this in my cronjob line:

Code: Select all
# every hour at 15 minutes past we process the queued messages
15 * * * * /usr/local/scripts/phplist -p processqueue


I then edited the phplist file to reflect the locations of my config.php and admin/index.php file.

3. I found no need to include any login or password variables in the call to the admin/index.php file. The problem for me was that a cronjob does not have a USER environment variable set and it is from this that the admin/index.php file checks against commandline_users.

The solution was to create a pseudo (non existent) user in the commandline_users variable in the config.php file. so ...

Code: Select all
$commandline_users = array("listprocessor","any other","users,"you want","to set");


I then inserted the following in my phplist file which would set the USER environment varibale (if it wasn't already set)

Code: Select all
# Check the USER variable is set
if [$USER]; then
   echo found USER variable
else
   USER=listprocessor
   export USER
fi

this went just below the line
Code: Select all
export CONFIG


finally make sure the phplist file is executable (chmod 755)

That did it for me - hope it helps
Julianna
PL Nut
 
Posts: 25
Joined: 10:28am, Mon 15 May, 2006

Re: How to make PHPlist work with Cron Jobs

Postby dani190 » 1:33pm, Wed 31 Jan, 2007

FROM Daniela's first post....

i try this and i get a list of errors but cant post them here. it just outputs like

Code: Select all
X-Powered-By: PHP/4.4.4
Set-Cookie: PHPSESSID=dd64053669ad70b2ed79fa2dfec6681b; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html


i cant post any more forums wont let me post links

but that goes on even longer maybe you are familiar with it?

every single cron job i try gives that error or message out to me, and my messages in the queue stay there.
dani190
PL Nut
 
Posts: 22
Joined: 6:11pm, Mon 29 Jan, 2007

Totally Out Of Idea

Postby t3nooq » 3:48am, Fri 11 May, 2007

hi. i'm a new super newbie to phpList. currently i've followed Daniela's instruction on the 1st page but nothing happens. i'm currently need to send one news to about 500-600 my client emails every month. the news should be in html format and it should be from my company news web page (one page). can i send the page link so it will view as html page in my client email. can anyone help me? -thanks- :?:
t3nooq
phpLister
 
Posts: 8
Joined: 1:05pm, Thu 10 May, 2007


still this error in mail

Postby vincentnjara » 11:28am, Thu 02 Aug, 2007

I have configured cron for processqueue as mentioned above, still I receive error below through mail.


Some errors occurred in the PHPlist Mailinglist System
URL:
Error message(s):

Error: You do not have enough privileges to access this page

==== debugging information

SERVER Vars
SHELL=
USER=xyz
PATH=
PWD=
SHLVL=1
HOME
LOGNAME=xyz
_=PHP_SELF=
argv=Array
argc=4

thanks in advance for any help
vincentnjara
phpList newbie
 
Posts: 2
Joined: 11:13am, Thu 02 Aug, 2007

Re: still this error in mail

Postby H2B2 » 7:31pm, Thu 02 Aug, 2007

vincentnjara wrote:Error: You do not have enough privileges to access this page

Possibly related to these posts:
viewtopic.php?p=31844#31844
viewtopic.php?p=16680#16680
viewtopic.php?p=21037#21037
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Some errors occurred in the PHPlist Mailinglist System

Postby vincentnjara » 3:42am, Fri 10 Aug, 2007

I have configured cron for processqueue as mentioned above, still I receive error below through mail.


Some errors occurred in the PHPlist Mailinglist System
URL:
Error message(s):

Error: You do not have enough privileges to access this page

==== debugging information

SERVER Vars
SHELL=
USER=xyz
PATH=
PWD=
SHLVL=1
HOME
LOGNAME=xyz
_=PHP_SELF=
argv=Array
argc=4

thanks in advance for any help

I have found out a solution for this error.

1) Go to database table ‘phplist_task’ and get the id of the row for processqueue.
2) Then in table ‘phplist_admin_task’ search for the row that has admin user Id (Id of user who suppose to access the processqueue through cron) and the Id mentioned in the step 1.
3) If such a row exists then edit the value of ‘level’ column to 1(if the value is 0).
4) If such a row do not exists the create a new row with a admin user Id (Id of user who suppose to access the processqueue through cron) and the Id mentioned in the step 1 and the ‘level’ column value as 1.

Hope this information will be usefull to All
Vincent
[/code]
vincentnjara
phpList newbie
 
Posts: 2
Joined: 11:13am, Thu 02 Aug, 2007

After much trials and tribulations...

Postby chibiaida » 10:12pm, Thu 16 Aug, 2007

Newbie here...

After spending the entire day trying to set up Cron on Bluehost, I got a Cron Daemon email after a run that says:

Code: Select all
PHPlist version 2.10.4 (c) 2000-2007 Tincan Ltd, http://www.phplist.com
Usage: /home/chibiswitch/public_html/phplist/admin/index.php -p page  [other parameters]


Does that mean that it ran successfully?? How can one tell that the cron job was completed??
chibiaida
phpList newbie
 
Posts: 1
Joined: 10:09pm, Thu 16 Aug, 2007

Postby knonymouse » 8:41am, Mon 20 Aug, 2007

I monitor the cron job by having my own email address at the top of the users list and also at the bottom (so I should know when the first and last messages are sent through the email stream.)

Also tell the server to make the cron verbose and send an email to you notifying you each time it triggers.

Just yesterday, everything that phplist reported and the cron reported looked just fine... except no emails received. When I send a test message, it wasn't received. Some problem at the server I suppose. Fortunately, back to normal now. Go figure.
knonymouse
PL Nut
 
Posts: 22
Joined: 12:54am, Thu 06 Apr, 2006

Postby santos.john » 5:21pm, Mon 24 Dec, 2007

staticfiends wrote:now it gives me this sent to me: :shock:

Code: Select all
Content-type: text/html
X-Powered-By: PHP/4.3.10
Set-Cookie: PHPSESSID=b5f14d33e1a5c188f1fed91fb37e5baf; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache


hat is weird is i can put the command in and it will run. but once I put it in a cron job it doesnt run. I do have cron capabilities

this is my cron job anything wrong with it? Thx
santos.john
phpList newbie
 
Posts: 3
Joined: 5:09pm, Mon 24 Dec, 2007

Postby WinstonN » 7:05pm, Mon 24 Dec, 2007

halo,

try this cron setup,
viewtopic.php?t=13713

cheers,
wins
WinstonN
PL Master
 
Posts: 158
Joined: 3:31pm, Sun 04 Feb, 2007
Location: Cape Town, South Africa

UN and Password

Postby manfredk » 1:29pm, Sun 24 Feb, 2008

Hi
Have not got the Cron job working YET (coming back with Permission denied.
In the Example given (Daniela) which Username and Password is meant? Is the the one to access the Domain Control Panel or the Mysql Password or the List Admin Login Password?
Have tried a couple of combinations so far but still Cron Job Report back of / Permission Denied.
do any of the files need to be maybe set to 755 or 777
Much Appreciated
manfredk
phpList newbie
 
Posts: 3
Joined: 8:35am, Mon 18 Feb, 2008

cron job processqueue (CGI not CLI, on shared host)

Postby wspademan » 3:20pm, Sat 19 Apr, 2008

On my shared-host site, with cpanel, the phplist script does not work (because BASH is not installed). Also the server does not have the CLI version of PHP5, so I was getting HTML output from the cron job. Here's what finally worked (using phplist version 2.10.5):

Well, I spent two hours composing a solution that I think would help many people on this subject, but the system won't accept it (it thinks I am spamming). Contact me if you want my solution. I had to edit index.php in admin AND create the cron job properly.
wspademan
phpList newbie
 
Posts: 1
Joined: 2:00pm, Sat 19 Apr, 2008

PreviousNext

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron