In contrast to the workaround given below it seems that your cpanel username may be required for recent versions of phplist and you may need to use the full $commandline_users = array(USERNAME) rather than the trick of using $commandline_users = array(); .
Therefore do not treat this article as gospel and please comment on any experiences you have so we can ascertain exactly what the current state of play is regarding the use of $commandline_users.
---------------------------------------------------------------------------------------
Having messed around trying to get phplist working for what seems like forever now I've finally found a combination that works. Hopefully these instructions (collected from many, many other posts on the subject) should work for you too.
First, ftp into your webspace and navigate to the phplist directory. Once inside that enter the config directory and download config.php. Now open the file in a text editor and look for a line similar to the one below. Change it to be exactly like the one shown below:
- Code: Select all
$commandline_users = array();
Note the lack of words/characters inside the array() brackets. The above line disables a feature that checks to see whether the 'server user' is authorized to control phplist. I could not get it working with this enabled and don't think (unless someone can tell me otherwise) it's a major issue to turn it off.
Btw. Due to us disabling the $commandline_users feature you won't shouldn't have to add username and password parameters to the cron line like some other posts on the topic suggest.
If you haven't yet you will also need to edit some of the other parameters in config.php such as user details and batch size. Most of these options should be easy enough to work out from the documentation, however one important thing to get right here is the MAILQUEUE_BATCH_SIZE. Your webhost likely imposes a limit on the number of emails you can send (typically per hour). You will need to check with your host to find out what the maximum number you can send is and if it isn't enough ask them to increase it. Once you know your limit set your batch size to just less than your sending limit. You will also need to set MAILQUEUE_BATCH_PERIOD to whatever the timeframe is (setting it to 3600 seconds equals a batch time of one hour.)
Once your all done ftp the file back up to your web space in place of the original.
Next in your cpanel select the cron icon and choose the 'Standard' experience level option. In the 'Command to run:' textbox stick the following text (it's all one line) but change *USERNAME* and *PHPLISTDIR* to your own):
- Code: Select all
/usr/local/bin/php /home/*USERNAME*/public_html/*PHPLISTDIR*/admin/index.php -p processqueue
You will also need to select the regularity you want cron to run at (each hour of everyday for example) and click save. I recommend setting it to a frequency of 'every other minute' of every hour, day & month to test with. This means it will be trying to send emails (ie: process the queue) every two minutes.
Once it's working you'll need to lower how often the command is run. If your batch period is 3600 seconds, then selecting 'every hour' would be perfect.
Now in the phplist admin click on 'Send a message' and create a basic mailout. Save it, select the 'List' tab in messages, select the test list (make sure your email address is signed up to it) and click on "Send to selected mailinglists". Do NOT press "Process queue" afterwards as it's cron's job to automatically start the process queue routine for you with the text you entered above. The test list was present by default with my phplist installation however if no test list is present you will need to create one yourself first.
Assuming you set it up correctly cron should send you an error/confirmation email each time it is set to run (receiving any cron emails, even errors, is good news as it means the cron part is working).
Once you have phplist successfully sending mailouts you can add: " > /dev/null" to the end of the line to stop it from sending all those confirmation mails and flooding your inbox. The final output looks like this:
- Code: Select all
/usr/local/bin/php /home/*USERNAME*/public_html/*PHPLISTDIR*/admin/index.php -p processqueue > /dev/null
Hopefully you should now have everything working. While the above instructions are for my host there's every chance they'll work for you too - or at least get you 90% of the way there!
Troubleshooting
If you are receiving emails with error messages from cron try entering the text (or part thereof) in the forum search to get a better idea of the problem and (usually) find a fix to the issue.
If you are receiving some sort of email from cron, but it is not sending the newsletter to anyone try tweaking the cron command text. Have a look at some other forum posts on this issue and try any alternative command strings people are using. Some people might find that lengthening their string to add the path to config.php helps:
- Code: Select all
/usr/local/bin/php /home/*USERNAME*/public_html/*PHPLISTDIR*/admin/index.php -pprocessqueue -c/home/*USERNAME*/public_html/*PHPLISTDIR*/config/config.php
Another is to change the path to php from:
- Code: Select all
/usr/local/bin/php [...]
to just
- Code: Select all
php [...]
or, whatever directory your webhost has it setup as (use phpinfo() to find out).
-> http://uk.php.net/phpinfo
If you only seem to be sending a limited number of emails, or your account is being locked out, or it works sometimes and other times not then remember that your webhost is probably imposing a limit on the number of emails you can send and this may be affecting phplist's sending abilities.
Lastly it's worth mentioning that your host will need to have the command line version of php enabled (php comes in two versions: command line and cgi). While a large number of webhosts do supply a command line version if you encounter problems you should always contact them to check.
If your host does not have the command line version of php installed there are other ways of triggering the process queue through cron. A great how to on this is topic: 15148...
-> http://forums.phplist.com/viewtopic.php?t=15148
If this works for you please let us know! Also if you have any additions or corrections post them below and I'll update this first post. Cheers.
Ps. More info here....
--> http://forums.phplist.com/viewtopic.php?f=16&t=9856
--> http://docs.phplist.com/CronJobExamples