[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

Re: [how to] make phplist work with Cron Jobs

Postby snyperthugs » 3:36am, Mon 24 May, 2010

OK now I am TOTALLY new to dealing with phplist with cronjobs.... So after I do EXACTLY what is listed... how do I know if its working properly?? And I have already gotten 6 emails saying this:

PHPlist version 2.10.12 (c) 2000-2010 Tincan Ltd, http://www.phplist.com
Usage: /home/WEBSITE/public_html/lists/admin/index.php -p page [other parameters]


What this all about?? The host only allows 100 emails per hour. I would really really appreciate any help. You can also contact me through AIM or YIM

AIM: snyperthugs
Yahoo: unbeatableent
snyperthugs
phpLister
 
Posts: 6
Joined: 6:58am, Tue 13 May, 2008

Re: [how to] make phplist work with Cron Jobs

Postby Leo086 » 8:38am, Thu 27 May, 2010

i got the same email message as mentioned above ...
anyone have a clue ?! !!!
Leo086
phpList newbie
 
Posts: 1
Joined: 7:49am, Thu 27 May, 2010

Re: [how to] make phplist work with Cron Jobs

Postby siamak72 » 6:19am, Mon 28 Jun, 2010

I still have this issue with the embargoed messages,..
although I have used the same system before, it just shows no activity when the time is set for sending mail,.. it also will not work when I send immediately.....

please help... the newbieeee
siamak72
phpList newbie
 
Posts: 4
Joined: 11:11pm, Fri 11 Dec, 2009

Re: [how to] make phplist work with Cron Jobs

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

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

Re: [how to] make phplist work with Cron Jobs

Postby bryancutts » 4:24am, Fri 06 Apr, 2012

Hi, thanks to all who have contributed... all seems well written etc.

As a non-coding ingrate, I am still a little confused. The reason is that at the beginning of your post you state that the following code should be pasted...

#!/bin/bash

# script to run PHPlist from commandline. You may need to edit this to make it work
# with your shell environment. The following should work for Bash

# in commandline mode, access is restricted to users who are listed in the config file
# check README.commandline for more info

# identify the config file for your installation
CONFIG=/home/water/public_html/fountain/config/config.php
export CONFIG

# alternatively you can use -c <path> on the commandline

# run the PHPlist index file with all parameters passed to this script
/usr/bin/php /home/water/public_html/fountain/admin/index.php $*


Please forgive my ignorance, but I am reasonably certain that not everything you have posted gets pasted in; for example "...You may need to edit this to make it work
# with your shell environment. The following should work for Bash..."

I don't have the assumed knowledge as to what does and doesn't comprise the relevant code.

Is it possible please to post up only what should be pasted into the directory? Without the 'extra' bits?

Apologies for being annoying and picky, and thanks in advance for your help.

Cheers,

bryan
bryancutts
phpList newbie
 
Posts: 1
Joined: 6:38am, Mon 24 Oct, 2011

Re: [how to] make phplist work with Cron Jobs

Postby ittbabis » 2:14pm, Fri 14 Feb, 2014

Daniela wrote:I've seen a lot of people asking how to setup PHPlist to send e-mail automatically, especially when their databases are big (like mine 68,000) or their hosts does not allow them to send more than a couple of e-mails an hour. :idea:
I'll try to explain them as simple as possible.
I organized a couple of discussions, and I will like to thank karma and drubarth, they are definitely the best. :D
I hope this can get everybody working.
You can chek their original discussion at their links :
http://www.phplist.com/forums/viewtopic.php?t=2146
http://www.phplist.com/forums/viewtopic.php?t=2142
http://www.phplist.com/forums/viewtopic.php?p=6540#6540

:roll:
Our domain is going to be called "water" (I'm using common words so they don't get confusing during the explanation). http://www.water.com
Our PHPlist installation is going to be installed in the directory "fountain"
Username : "fish" and password : "seashell"


First of all, (like most mortals) you have to install PHPlist.
On our case,we go through Fantastico and install it.
Now we have to create a file called "phplist" (without the quotes please) in the same directory as the phplist installation.
The file should contain the follwing code

#!/bin/bash

# script to run PHPlist from commandline. You may need to edit this to make it work
# with your shell environment. The following should work for Bash

# in commandline mode, access is restricted to users who are listed in the config file
# check README.commandline for more info

# identify the config file for your installation
CONFIG=/home/water/public_html/fountain/config/config.php
export CONFIG

# alternatively you can use -c <path> on the commandline

# run the PHPlist index file with all parameters passed to this script
/usr/bin/php /home/water/public_html/fountain/admin/index.php $*


Copy and paste it as it is, but remember to replace the domain, directory, user, password, etc. Double check there are no spaces or enter after the last character.


One this is completed, now we have to edit a file named "config.php" which is located in /public_html/fountain/config/
Check that the following line looks like this :
define ("MANUALLY_PROCESS_QUEUE",1);
And this line:
define("MAILQUEUE_BATCH_SIZE",0);
Now look for the following lines
# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",60);


and add the following line after it:
# Throttle sending messages; indicates the number of milliseconds to pause
# between each message (millisecond is one-millionth of a second)
define("MAILQUEUE_PROCESSING_THROTTLE",2000000);


This means is going to send an e-mail every 2 secconds.

Now look for the file "processqueue.php" in the directory /public_html/fountain/admin/
Find the following line:
output("Sending $messageid to $useremail");
sendEmail($messageid,$useremail,$userhash,$htmlpref,$rssitems);


and add the following just after it
usleep(MAILQUEUE_PROCESSING_THROTTLE);

Save the file.

We are almost done. Just hang on a little.
Now lets go to cron jobs.
You just have to sent this up once, the day and hour you want the queue to start to be processed.
The command should look like this
php /home/water/public_html/fountain/admin/index.php page=processqueue login=fish password=seashell

Now relax, prepare you message, queue it, and just watch it work.
By the way don't hit the process queue that you have on the phplist homepage, just forget about that link.

By the way, just let me know if it worked.




Hello to everyone,

I am a newbie. This is my first time in the forum since I have a problem and cannot find solution.

The user DANIELA, gave us these usefull tips, but I have a problem in my ( processqueue.php ) file.

Unfortunatelly I cannot find the exact match for the lines............

output("Sending $messageid to $usermail");
sendEmail($messageid,$usermail,$userhash,$htmlpref,$rssitems);
.................

The CLOSEST I can have is the code part..........................

if ($cansend) {
$success = 0;
if (!TEST) {
if (!$throttled) {
if (VERBOSE)
output($GLOBALS['I18N']->get('Sending').' '. $messageid.' '.$GLOBALS['I18N']->get('to').' '. $useremail);
$timer = new timer();
$success = sendEmail($messageid,$useremail,$userhash,$htmlpref,$rssitems);
if (VERBOSE) {
output($GLOBALS['I18N']->get('It took').' '.$timer->elapsed(1).' '.$GLOBALS['I18N']->get('seconds to send'));
}
} else {
$throttlecount++;
}
} else {
$success = sendEmailTest($messageid,$useremail);
}
...................................

Is This the point where DANIELA was referring about ???

Can anyone please show a hint?

Your help is very much appreciated in advance....

Thank you ALL !!!
ittbabis
phpList newbie
 
Posts: 1
Joined: 1:53pm, Fri 14 Feb, 2014

Re: [how to] make phplist work with Cron Jobs

Postby Dragonrider » 9:55pm, Fri 14 Feb, 2014

ittbabs - What version of phpList are you running? I assume version 3.0.x as the code you refer to above, is in fact for Version 2, so it ain't going to work with V3, sorry.
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net, http://dragonrider.co.uk
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Dragonrider
Moderator
 
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: [how to] make phplist work with Cron Jobs

Postby jasonfranz » 7:22pm, Tue 04 Mar, 2014

We are almost done. Just hang on a little.
Now lets go to cron jobs.
You just have to sent this up once, the day and hour you want the queue to start to be processed.
The command should look like this
php /home/water/public_html/fountain/admin/index.php page=processqueue login=fish password=seashell


This solved the upgrade to phpList 3.0 on hostgator problem for me! Thank you! Cron is processing messages as before now.

Now if I can only fix the broken subscription notification emails I'll be all set...
jasonfranz
PL Nut
 
Posts: 18
Joined: 9:31pm, Mon 05 Mar, 2007

Re: [how to] make phplist work with Cron Jobs

Postby pbraconnot » 3:52pm, Wed 05 Mar, 2014

I placed this CRON JOB in superuser crontab:
Code: Select all
/var/bin/phplist -p processqueue -c /var/www/lists/config/config.php


This command runs normally through CLI but does nothing through CRON.
I ran it as a PHPList superuser which I also created as a Linux sudo user as well.
Version 3.0.5
Using CLI it sends my 45 batch messages and exit normally. The CRON would run it repeatedly. It runs about every 9 min and shows up in syslog but nothing happens.
On the Active campaigns still shows:
inprocess
1172 still to process
Stalled

This is my script phplist as I send configuration link on the command itself I commented the CONFIG part (tried both ways anyway)

Code: Select all
#!/bin/bash

# script to run PHPlist from commandline. You may need to edit this to make it work
# with your shell environment. The following should work for Bash on Fedora Linux
# but this may vary strongly in other situations. You will need to dig into the
# code to make sure it works for you.

# in commandline mode, access is restricted to users who are listed in the config file
# check README.commandline for more info

# identify the config file for your installation
#CONFIG=/var/ihop/PHPNews/lists/config/config.php
#export CONFIG

# alternatively you can use -c <path to config file> on the commandline

# run the PHPlist index file with all parameters passed to this script
/usr/bin/php5 /var/ihop/PHPNews/lists/admin/index.php $*


I am on Ubuntu 12.04 VPS, using the parameters page=... and action=... login=username password=xxxx throws an error like "config not found".
pbraconnot
phpLister
 
Posts: 9
Joined: 3:04pm, Thu 11 Nov, 2010

Re: [how to] make phplist work with Cron Jobs

Postby pbraconnot » 7:35pm, Wed 05 Mar, 2014

[solved] I was not receiving CRON erros then I could fix it.
found this error:
Error: USER environment variable is not defined, cannot do access check. Please make sure USER is defined.

the answer is here

http://www.tequilafish.com/2005/11/17/p ... t-defined/

Just define the user in the script phplist

Code: Select all
USER=youusername
export USER
pbraconnot
phpLister
 
Posts: 9
Joined: 3:04pm, Thu 11 Nov, 2010

Re: [how to] make phplist work with Cron Jobs

Postby gkornbluth » 5:46pm, Tue 01 Apr, 2014

Hi All,

Thanks to Daniela for the detailed post on how to set up a cron job.

However, near as I can tell, it's only valid for versions below 3.0, and try as I might, I can't get a cron job to work.

For the login and password I'm using the PHPlist admin login credentials.

There are a few steps in Daniela's post that don't correlate to 3.0 5 and I'm sure that they are the culprit.

Has anyone compiled a similar cookbook approach to setting up a cron job in 3.05 (or can anyone who has been successful post the detailed steps required?)

My host's cron report email (Bluehost) shows the code for the PHPList home page and no indication of errors that I can trace down.

Thanks for any help,

Jerry Kornbluth
gkornbluth
phpList newbie
 
Posts: 4
Joined: 4:33pm, Wed 12 Mar, 2014

Re: [how to] make phplist work with Cron Jobs

Postby activate1 » 6:40pm, Sat 17 May, 2014

I am also looking for a good advice,

I am on 3.06 and need a cron for email sending and handling bounces.

if someone could help it would be nice!
activate1
PL Geek
 
Posts: 99
Joined: 10:29am, Fri 25 Apr, 2014

Re: [how to] make phplist work with Cron Jobs

Postby bineeshtvr » 11:14am, Thu 31 Jul, 2014

hello dears,

i didnt find the lines :

output("Sending $messageid to $useremail");
sendEmail($messageid,$useremail,$userhash,$htmlpref,$rssitems);

what should i do ?
bineeshtvr
phpList newbie
 
Posts: 3
Joined: 2:27pm, Mon 21 Jul, 2014

Re: [how to] make phplist work with Cron Jobs

Postby bineeshtvr » 11:17am, Thu 31 Jul, 2014

hello ,

for a cron as :

php -q /home/thinks86/public_html/marketing/admin/?page=processqueue login=my user id password=my password

i got this reply : no input file specified


please help
bineeshtvr
phpList newbie
 
Posts: 3
Joined: 2:27pm, Mon 21 Jul, 2014

Previous

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

cron