Page 1 of 1

Commandline sending with phpList on server running PHP-cgi

PostPosted: 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.
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");
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 ../

The file is called "phplist" - make sure it is with 755 permissions.

# 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
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/ $*

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 :$ ./phplist -pprocessqueue

Process bounces :$ ./phplist -pprocessbounces

The next thing you can do is just sit back and relax :)
Happy mailing!

PostPosted: 12:15am, Sat 31 Mar, 2007
by freedog96150
Thanks! This was the first post I can to when STF and it solved my issues!!

PostPosted: 6:32am, Sat 31 Mar, 2007
Hi ,

I am very happy to see that this topic already managed to help somebody. :D