Commandline sending with phpList on server running PHP-cgi

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.

Was this helpful ?

Yes
2
100%
A part of it
0
No votes
No
0
No votes
 
Total votes : 2

Commandline sending with phpList on server running PHP-cgi

Postby phphostingdeals.com » 5:43pm, Fri 30 Mar, 2007

We would like to provide a complete solution of how to reach maximum results,
when sending a newsletter with phpList on a server running PHP-cgi instead of PHP-cli.

Depending on whether you have a daily limit on your emails or not , you can have the following feature
enabled or disabled :
This is inside the ../lists/config/config.php
-----------------------------------------------------------------------------------------
Two primary settings work together to say: Send no more than N emails every T minutes.
Where:
N is MAILQUEUE_BATCH_SIZE
T is MAILQUEUE_BATCH_PERIOD
These settings force phpList to "pace itself".
The last setting, MAILQUEUE_THROTTLE, will space messages apart by some number of seconds.
-----------------------------------------------------------------------------------------

More detailed information on this could be found in numerous posts on this forum.

In my case the "batch processing" is disabled - define("MAILQUEUE_BATCH_SIZE",0);

The method is using the commandline script called "phplist".
-----------------------------------------------------------------------------------------
1.Changes for ../lists/config/config.php

- You will need to identify the users who are allowed to run the script, so change this :
$commandline_users = array("username");
define ("MANUALLY_PROCESS_QUEUE",1);
-----------------------------------------------------------------------------------------
2. Go to the ../lists/admin/
The following actions are required in order to be able to run the ../lists/admin/index.php in a browser
and in the same time have it executable via the commandline.

Make a copy of the index.php file and call it index2.php
Choose to edit the index2.php and find these lines :

A)Line 6:
Original: if (!isset($_SERVER["SERVER_NAME"]) && !PHP_SAPI == "cli") {

Replace with: if (!isset($_SERVER["SERVER_NAME"]) && !PHP_SAPI == "cgi") {

B) Line 23:
Original: if (php_sapi_name() == "cli") {
Replace with: if (php_sapi_name() == "cgi") {
-----------------------------------------------------------------------------------------
3. You will have to configure the commandline script "phplist" now.
A sample of it is located at ../domain.com/phpList/bin/

The file is called "phplist" - make sure it is with 755 permissions.
============================================================================
#!/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=/home/www/domain.com/phpList/public_html/lists/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/local/bin/php /home/www/domain.com/phpList/public_html/lists/admin/index2.php $*
============================================================================

Save the file and we are almost there.

Now you can load up you mailing queue from the phpList admin panel.
Once this is done , you are ready to run the following commands via the commandline :

Process the message queue :

username@domain.com:~/www/domain.com/phpList/bin$ ./phplist -pprocessqueue

Process bounces :

username@domain.com:~/www/domain.com/phpList/bin$ ./phplist -pprocessbounces

The next thing you can do is just sit back and relax :)
Happy mailing!
phphostingdeals.com
phpList newbie
 
Posts: 2
Joined: 4:42pm, Fri 30 Mar, 2007

Postby freedog96150 » 12:15am, Sat 31 Mar, 2007

Thanks! This was the first post I can to when STF and it solved my issues!!
freedog96150
phpList newbie
 
Posts: 1
Joined: 10:31pm, Thu 29 Mar, 2007

Postby phphostingdeals.com » 6:32am, Sat 31 Mar, 2007

Hi ,

I am very happy to see that this topic already managed to help somebody. :D
phphostingdeals.com
phpList newbie
 
Posts: 2
Joined: 4:42pm, Fri 30 Mar, 2007


Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest