Command Line Instructions

Advanced Questions & Problems

Moderators: Dragonrider, J_S, Hernol, vancoovur, H2B2, Heritage

Do you use commandline to process queue?

Yes, it worked easy!
4
8%
It worked after lots of hours
13
25%
I tried and never worked
22
42%
I would like to try it in the future
10
19%
No, I don't need it
4
8%
 
Total votes : 53

Postby magnum2000 » 2:45pm, Wed 20 Oct, 2004

Hi all!
Hi'm having the same problem.

This is my php version
Code: Select all
PHP 5.0.0RC2-dev (cli) (built: Apr  9 2004 17:53:19)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0RC2-dev, Copyright (c) 1998-2004 Zend Technologies


and the version of phplist is the 2.8.11

After make the changes in "config.php", i've tried to run the script "phplist" under "bin" folder.
It return a page that show (under console) a login page; seems it don't recognize the user! :?

I have also tried to run the page with the GET method, but is the same.

Where is the problem? :roll:
magnum2000
phplist newbie
 
Posts: 1
Joined: 2:33pm, Wed 20 Oct, 2004

Postby drubarth » 7:21pm, Tue 28 Dec, 2004

Here's some great info about the command line options in PHP, and specifics about CGI and CLI.

http://www.php.net/manual/en/features.commandline.php

If when you type php -v you get (cgi), then you can't run the command line instructions because the admin/index.php specifically looks at the PHP_SAPI variable.

I have the CGI SAPI, so I'm looking into alternatives, such as a second PHP instance, or making code mods to the admin/index.php file so that it also works in CGI mode. I've tried the WGET option, but it doesn't process all of the batches unless I execute it many times with the reload parm incremented each time.

Sure would like a CGI solution!


Darryl
drubarth
PL Master
 
Posts: 188
Joined: 10:14pm, Fri 17 Dec, 2004

Postby Telfie » 2:55pm, Fri 01 Jul, 2005

Hi

I have been attempting to get the processqueue settings happening on a site however I keep getting errors relating to permissions.

I have been attempting just about all the options that have been put forward on the site but to no avail.

I have added to my config.php file my account username as well as the phplist user names in the $command_line_user section.

Here are the options I have tried and the results.
Option 1:
CRON Command as per cPanel
php /home/ACCOUNT/public_html/mail_list/admin/index.php page=processqueue login=PHP_LIST_USER password=PASSWORD


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

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

==ebugging information

SERVER Vars
SHELL=in/sh
MAILTO=drew@reliablesolution.com.au
PATH=sr/bin:/bin
PWD=ome/*****
SHLVL=
HOME=ome/*****
LOGNAME=*****
_=sr/bin/php
PHP_SELFargv=ray
argc=


Error Email 1 Received
Content-type: text/html
X-Powered-By: PHP/4.3.11
Set-Cookie: PHPSESSID=2540ec97953ec64a0ea936331951e82f; 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

<!-- using ../config/config.php -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html><head>
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate"> <meta http-equiv="pragma" content="no-cache"> <link rev="made" href="mailto:phplist%40tincan.co.uk">
<link rel="home" href="http://www.phplist.com" > <link rel="copyright" href="mailto:phplist%40tincan.co.uk" > <meta name="Author" content="Michiel Dethmers - http://www.phplist.com"> <meta name="Copyright" content="Michiel Dethmers, Tincan Ltd - http://tincan.co.uk"> <meta name="Powered-By" content="PHPlist version 2.9.4"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script language="javascript" type="text/javascript" src="js/select_style.js"></script><meta http-equiv="Cache-Control" content="no-cache, must-revalidate"><meta http-equiv="Pragma" content="no-cache"><title>PHPlist :: PHPlist :: Send message queue</title> <link href="styles/phplist.css" type="text/css" rel="stylesheet"> </head> <body bgcolor="#ffffff" background="images/bg.png"> <a name="top"></a> <div align=center> <table cellspacing=0 cellpadding=0 width=710 border=0> <tr> <td bgcolor="#000000" rowspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td> <td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=708 border=0></td> <td bgcolor="#000000" rowspan=3><img height=1 alt="" src="images/transparent.png" width=1
... this is basically the login page

Option 2:
php /home/ACCOUNT/public_html/mail_list/admin/index.php?page=processqueue&login=PHP_USER_NAME&password=PASSWORD


Result:
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.11

No input file specified.


Option 3:
/home/ACCOUNT/public_html/bin/phplist -p processqueue login=PHP_LIST_USER password=PASSWORD


Result:
Email 1
The login screen via email indicating that it has logged in



If anyone has any ideas or suggestions, it would be much appreciated as it is very early in the morning and I would like to see some light at the end of the tunnel that has been going for the last 2 days ....

Thanks :)
User avatar
Telfie
phplister
 
Posts: 10
Joined: 3:33am, Fri 01 Jul, 2005
Location: Sydney

Postby drubarth » 3:44pm, Fri 01 Jul, 2005

It appears that you have the cgi version of php (see my previous post in this topic). If you want to run php from the command line you need the cli version. I'm guessing that installing a second instance of php with the cli option is probably too technical for you.

The other alternative is to use the GET, WGET or LYNX commands and call the web page. Search the forum for WGET and you should find some instructions. The big problem you'll see complained about with GET/WGET is that you have to setup multiple cron runs with the reload parameter incremented for each batch. A second big problem is that it will timeout with the webserver if the batch takes too long, so it forces you to set a smaller batch size (and therefore more reloads).

The php-cli version is the way to go if at all possible. Or you can find a hosting provider who already has this stuff figured out (cuz you'll spend another 20-60 hours at least working on this; see the poll at the beginning and you'll see a lot of people worked on this and never figured it out).

Fyi, www.Exyst.com already has this stuff all figured out. I happen to be the company owner. We'd be glad to help you setup in no time at all.


Cheers,
Darryl Rubarth

Web hosting and support for open-source solutions
www.exyst.com
drubarth
PL Master
 
Posts: 188
Joined: 10:14pm, Fri 17 Dec, 2004

Postby Telfie » 12:32am, Sat 02 Jul, 2005

Thanks ... I will make some enquiries and see what I can come up with.
User avatar
Telfie
phplister
 
Posts: 10
Joined: 3:33am, Fri 01 Jul, 2005
Location: Sydney

Postby Telfie » 2:32am, Sat 02 Jul, 2005

Hello

Ok ... I got this to work. My server was already a cli version of php. however, I appear to be only to get this to work using the lynx command. I have published my settings below, I hope this helps others. I have found various parts of the information on other parts of this forum and with some of my own 'stuffing around'.

Note: Information in CAPITALS needs to be replaced with information specific to your system. I have attempted to use descriptive names for thes parts.

I am using the lynx command

cron settings.
Code: Select all
0 * * * * lynx -dump 'http://www.domain.com.au/mail_list/admin/index.php?page=processqueue&login=LIST_USER&password=PASSWORD' > /dev/null
This will process any pending emails

Code: Select all
30 * * * * lynx -dump 'http://www.domain.com.au/mail_list/admin/index.php?page=processbounces&login=LIST_USER&password=PASSWORD' > /dev/null
This will process any bounced emails sent to our bounce email mailbox (in my case noreply.

My config.php file has:
For Command Line
Code: Select all
$commandline_users = array("root","LIST_USER","admin","SERVER_ACCOUNT");
# MY COMMENT:
# I have added server and phplist users here in an attempt to ensure that the correct user is authorised.


For Bounce Processing
Code: Select all
$message_envelope = 'noreply@DOMAIN.com.au';


Code: Select all
# set this to 0, if you set up a cron to download bounces regularly by using the
# commandline option. If this is 0, users cannot run the page from the web
# frontend. Read README.commandline to find out how to set it up on the
# commandline
define ("MANUALLY_PROCESS_BOUNCES",0);


Code: Select all
# when the protocol is pop, specify these three
$bounce_mailbox_host = 'DOMAIN.com.au';
$bounce_mailbox_user = 'noreply@DOMAIN.com.au';
$bounce_mailbox_password = 'EMAIL_PASSWORD';


Processing Queue
Code: Select all
# If you set up your system to send the message automatically, you can set this value
# to 0, so "Process Queue" will disappear from the site
# this will also stop users from loading the page on the web frontend, so you will
# have to make sure that you run the queue from the commandline
# check README.commandline how to do this
define ("MANUALLY_PROCESS_QUEUE",0);

# batch processing
# if you are on a shared host, it will probably be appreciated if you don't send
# out loads of emails in one go. To do this, you can configure batch processing.
# Please note, the following two values can be overridden by your ISP by using
# a server wide configuration. So if you notice these values to be different
# in reality, that may be the case

# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",200);
# MY COMMENT:
#I have a small list but to ensure I don't have server issues, I have batched this to relatively small amounts. This could be increased but I would strongly suggest ensuring that the server is capable of handling large amounts of email. Particularly on Shared Servers.

# define the length of one batch processing period, in seconds (3600 is an hour)
define("MAILQUEUE_BATCH_PERIOD",3300);
# MY COMMENT:
# Ensure that this number is [b]LESS THAN[/b] the time between running your cron process. In my case, my cron runs every 1hr (3600)

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',4);


I hope that this assists others out there ... :)

Now to figure out if we can send and email to the system and have it send that out automatically ...

UPDATE 2005-07-08
Code: Select all
# If you set up your system to send the message automatically, you can set this value
# to 0, so "Process Queue" will disappear from the site
# this will also stop users from loading the page on the web frontend, so you will
# have to make sure that you run the queue from the commandline
# check README.commandline how to do this
define ("MANUALLY_PROCESS_QUEUE",0);


Note ... if this is set to 0 ... and you run the commandline, this will not work ... (I found this out the otherday) make sure this is 1
Last edited by Telfie on 2:40am, Fri 08 Jul, 2005, edited 1 time in total.
User avatar
Telfie
phplister
 
Posts: 10
Joined: 3:33am, Fri 01 Jul, 2005
Location: Sydney

You are the man

Postby propheus » 2:11am, Fri 08 Jul, 2005

I have put about 20 hours into this already and the lynx command saved the day. Good on you!
propheus
phplister
 
Posts: 6
Joined: 7:05pm, Mon 14 Jun, 2004

Postby cabinone » 12:39am, Tue 13 Sep, 2005

This
Code: Select all
php /home/USER/public_html/lists/admin/index.php -pprocessqueue
worked once I updated my config file with this
Code: Select all
$commandline_users = array("root","admin","USER");


that's all i needed....thanks guys!

everything is now working with PHPLIST - bounces, crons...it's sooo sweet.

thanks Michiel!
cabinone
PL Nut
 
Posts: 17
Joined: 10:05pm, Tue 30 Aug, 2005

A dirty fix to get the CGI version of php to work

Postby vmadmin » 1:35am, Sat 17 Sep, 2005

My machine is running Fedora Core 2 and doesn't have php-cli (yeah, time to upgrade).

I don't suggest trying this on a machine that has it's web server setup to use php via CGI ( not using the Apache module of php ). This might be a security issue.

edit line 25 of public_html/lists/admin/admin.php ( phplist version 2.10.1 )
Code: Select all
if (php_sapi_name() == "cli") {

replace it with
Code: Select all
if (php_sapi_name() == "cgi") {


edit bin/phplist
Code: Select all
CONFIG=/path_to_phplist/public_html/lists/config/config.php
export CONFIG
USER=admin
export USER
/usr/bin/php /path_to_phplist/public_html/lists/admin/index.php $*


edit public_html/lists/config/config.php
Code: Select all
$commandline_users = array("admin");


Plug this into your crontab
Code: Select all
/path_to_phplist/bin/phplist -pprocessqueue
User avatar
vmadmin
phplist newbie
 
Posts: 1
Joined: 12:55am, Sat 17 Sep, 2005

Postby jotazzu » 3:27am, Sat 17 Sep, 2005

Hi,
Be aware that this does not emulate the cli version completely as the script timeout of 600s is still in effect with the cgi version (in safe_mode it is 30s).

Probably you will have to set up multiple schedules for lists with more than 1000 subscribers and have to delay the schedules with 1000s from each other (assuming that one email is sent per second). The 1000 emails sent before the timeout hits is a rough estimation and depends on the file size of the email.

The real execution time of the script is higher than the timeout because the time spent in the system (I/O, database) is not counted.
jotazzu
PL Master
 
Posts: 183
Joined: 6:31pm, Wed 13 Jul, 2005
Location: Hamburg, Germany

A more flexible solution to the cgi/cli problem.

Postby mgifford » 4:49pm, Wed 05 Oct, 2005

It seems like it's working now for me after making this change:

if (php_sapi_name() == "cli" || php_sapi_name() == "cgi") {

But yikes, that was more work to find the solution than I had hoped. I wanted to put in both the cgi & cli as when I upgrade this server to FC4 I don't want to have this script broken again.

One of my concerns though is that phplist did used to send out mail in larger batches than it does now.

From either the command line or through the web interface I'm getting reports of it sending out messages in batches of 7-25 for each shot.

-sh-2.05b$ ./phplist -pprocessqueue
Content-type: text/html
X-Powered-By: PHP/4.3.10
Set-Cookie: PHPSESSID=SNIP; 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

PHPlist version 2.10.1 (c) 2000-2005 Tincan Ltd, http://www.phplist.com
Started
In safe mode, batches are set to a maximum of 100
Sending in batches of 100 emails
This batch will be 76 emails, because in the last 120 seconds 24 emails were sent
Processing has started, 2 message(s) to process.
Processing message 657
Looking for users
Found them: 71 to process
Script stage: 5
21 messages sent in 89.63 seconds (843 msgs/hr)
Finished this run
Reload required

I know that in earlier installs this went faster. Perhaps it's the cusomtization that the client is adding to the emails, or the speed of the server.

I also thought that running php from the command line skipped safe mode restrictions.

Perhaps not, but it would make sense.... Just couldn't find the docs.

Mike
mgifford
phplister
 
Posts: 12
Joined: 9:31pm, Mon 01 Nov, 2004

Postby wilfy » 11:57am, Fri 28 Oct, 2005

just thought i would post this as another work around guys

my host has disabled wget, get and lynx and the server i am on is setup in cgi not cli.

so i created a php file in my userspace that calls the process queue page (with the login credentials) like this:

Code: Select all
#!/usr/local/bin/php
<?php
  include('http://www.madridlionsrfc.com/lists/admin/?page=processqueue&login=USERNAME&password=PASSWORD');
?>


This file must have 755 permissions so it can be executed.

Then all i did was set up a cron job to run this file like this:

Code: Select all
/home/madlions/public_html/lists/admin/pq.php


This does mean that you must enable MANUALLY_PROCESS_QUEUE in the config.php file, like this define ("MANUALLY_PROCESS_QUEUE",1); as essentially it is still being processed manually but the cron is doing the donkey work.

I have done this for getting my rss feeds too.

Another workaround would be to train a monkey to click process the queues for you freeing you up to do much more important stuff. The downside to this would be that you would obviously have to feed the little blighter due to laws relating to animal cruetly.

Hope this helps :lol:

PS only took me 8 hours to figure out that the normal cron setup would not work!!! be warned!
wilfy
phplist newbie
 
Posts: 3
Joined: 9:55am, Fri 26 Nov, 2004

Postby SamIAM » 5:34pm, Thu 10 Nov, 2005

my phplist used to work fine with cron jobs, until I moved to a new host.

ok, i see cli and cgi for php_sapi_name() in the thread.

when i did that on mine i get: apache

does that mean I cant do cron jobs ?
SamIAM
PL Nut
 
Posts: 22
Joined: 5:30pm, Fri 23 Sep, 2005
Location: Michigan

Postby SamIAM » 7:17pm, Thu 10 Nov, 2005

wilfy wrote:
Another workaround would be to train a monkey to click process the queues for you freeing you up to do much more important stuff. The downside to this would be that you would obviously have to feed the little blighter due to laws relating to animal cruetly.

Hope this helps


do u know a place where i can get a cheap monkey ?
SamIAM
PL Nut
 
Posts: 22
Joined: 5:30pm, Fri 23 Sep, 2005
Location: Michigan

Postby zeuschicago » 7:22pm, Fri 27 Jan, 2006

Did anyone figure out what the cause of getting the HTML output after running the commands was?

I have
Code: Select all
PHP 4.4.1 (cli) (built: Jan 18 2006 23:18:07)


edited the phplist script to point the paths to my configfile to the right location

editing the config file to include the users ("jbodine","root") to allow access to run the script from the command line

and when I execute the script
Code: Select all
./phplist -pprocessbounces


Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html><head>
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="pragma" content="no-cache" />
<link rev="made" href="mailto:phplist%40tincan.co.uk" />
<link rel="home" href="http://www.phplist.com" title="phplist homepage" />
<link rel="copyright" href="http://tincan.co.uk" title="Copyright" />
<link rel="license" href="http://www.gnu.org/copyleft/gpl.html" title="GNU General Public License" />
<meta name="Author" content="Michiel Dethmers - http://www.phplist.com" />
<meta name="Copyright" content="Michiel Dethmers, Tincan Ltd - http://tincan.co.uk" />
<meta name="Powered-By" content="PHPlist version 2.10.2" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<script language="javascript" type="text/javascript" src="js/select_style.js"></script><meta http-equiv="Cache-Control" content="no-cache, must-revalidate"><meta http-equiv="Pragma" content="no-cache"><title>PHPlist :: PHPlist :: Main Admin Page</title>
<link href="styles/phplist.css" type="text/css" rel="stylesheet">
</head>
<body bgcolor="#ffffff" background="images/bg.png">
<a name="top"></a>
<div align=center>
<table cellspacing=0 cellpadding=0 width=710 border=0>
<tr>
<td bgcolor="#000000" rowspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td>
<td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=708 border=0></td>
<td bgcolor="#000000" rowspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td>
</tr>

<tr valign="top" align="left">
<td>
<!--TOP TABLE starts-->
<TABLE cellSpacing=0 cellPadding=0 width=708 bgColor="#ffffff" border=0>
  <TR vAlign=top>
    <TD colSpan=2 rowspan="2" height="63" background="images/topstrip.png"><a href="http://www.phplist.com" target="_blank"><img src="images/masthead.png" border=0 width=577 height=75 alt=""></a></TD>
    <TD align=left
      background="images/topstrip.png" bgcolor="#F0D1A3"><FONT
      size=-2>&nbsp;<I>powered by: </I><BR>&nbsp;<B>[<A class=powered
      href="http://www.php.net/" target=_new><I>PHP</I></A>]</B> + <B>[<A
      class=powered href="http://www.mysql.com/"
      target=_new>mySQL</A>]</B></FONT></TD></TR>
  <TR vAlign=bottom>
    <TD vAlign=bottom width=132
    background="images/topright.png" bgcolor="#F0D1A3"><SPAN
      class=webblermenu>PHPlist</SPAN></TD></TR>
  <TR>
    <TD bgColor="#000000"><IMG height=1 alt=""
      src="images/transparent.png" width=20
      border=0></TD>
    <TD bgColor="#000000"><IMG height=1 alt=""
      src="images/transparent.png" width=576
      border=0></TD>
    <TD bgColor="#000000"><IMG height=1 alt=""
      src="images/transparent.png" width=132
      border=0></TD></TR>
  <TR vAlign=top>
    <TD>&nbsp;</TD>
<td><div align=left>
<br />
<p class="leaftitle">PHPlist - main admin page</p><div align="right" id="languageswitch"><br/><form name="languageswitch" method="post" style="margin: 0; padding: 0"><select name="setlanguage" onChange="document.languageswitch.submit()" style="width: 100px; font-size: 10px; color: #666666"><option value="de" >Deutsch </option><option value="en" selected>English </option><option value="es" >espa&ntilde;ol</option><option value="fr" >fran&ccedil;ais </option><option value="pt-br" >portugu&ecirc;s </option><option value="zh-tw" >Traditional Chinese</option></select></form></div><p>This document requires you to log in<br/>
<font class="error"></font>
<p>
<script language="Javascript" type="text/javascript">

if (!navigator.cookieEnabled) {
  document.writeln('<div class="error">In order to login, you need to enable cookies in your browser</div>');
}

</script>
<form method=post>
<input type=hidden name="page" value="home">
<table width=100% border=0 cellpadding=2 cellspacing=0>

<tr><td><span class="general">Name:</span></td></tr>
<tr><td><input type=text name="login" value="" size=30></td></tr>

<tr><td><span class="general">Password:</span></td></tr>
<tr><td><input type=password name="password" value="" size=30></td></tr>

<tr><td><input type=submit name="process" value="Enter"></td></tr></table>

<br/>
<p align="center"><hr width=50% size=3></p>
<b>Forgot Password?:</b><br/>
Enter your email: <input type=text name="forgotpassword" value="" size=30><br/><br/>
<input type=submit name="process" value="Send Password">

</form></div>
</td>
<td>
<div class="menutableright">
<span class="menulinkleft"><a href="./?page=home">main page</a><br /></span><span class="menulinkleft"><a href="./?page=about">about phplist</a><br /></span></div>
</td>
</tr>




<tr><td colspan="4">&nbsp;</td></tr>



<tr><td colspan="4">&nbsp;</td></tr>
</table>
<!--TOP TABLE ends-->

</td></tr>


<tr>
<td bgcolor="#000000" colspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td>
</tr>

<tr>
<td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=1 border=0></td>
<td bgcolor="#ff9900" class="bottom">&copy; <a href="http://tincan.co.uk" target="_tincan" class="urhere">tincan limited</a> | <span class="urhere">PHPlist powered by </span><a class="urhere" href="http://www.phplist.com" target="_blank">PHPlist</a> - version 2.10.2</td>
<td bgcolor="#000000"><img height=1 alt="" src="images/transparent.png" width=1 border=0></td>
</tr>

<tr>
<td bgcolor="#000000" colspan=3><img height=1 alt="" src="images/transparent.png" width=1 border=0></td>
</tr>

<tr>
<td colspan=3><img height=3 alt="" src="images/transparent.png" width=1 border=0></td>
</tr>

<tr>
<td colspan=3>
&nbsp;
</td>
</tr>
</tbody>
</table>

</div>
</body></html>
zeuschicago
phplister
 
Posts: 8
Joined: 7:18pm, Fri 27 Jan, 2006

PreviousNext

Return to Advanced Questions & Problems

Who is online

Users browsing this forum: No registered users and 0 guests