Cron, just not working

Once you've installed phpList Version 2... ask questions here!
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation. This is for Version 2 of phpList (the orange one).

Cron, just not working

Postby bear » 2:34am, Sat 19 May, 2007

I'm exhausted.
I have PHPList set up on this server on 2 different accounts, one using 2.8.12, and cron works fine using "/usr/local/bin/php -q /path/to/script/index.php -processqueue...etc".
With the newer one (using 2.10.4)on site#2 I can't get cron to work for love or money. I've tried the exact same method as site #1...nothing. Tried the command line script: from cron, nothing, from shell, works perfectly. I've tried the CL script in the user's home dir, and moving it into /usr/local. Tried calling it with only "phplist" and the full path "/usr/local/phplist". Even tried using ./ in front.

I've looked at every thread I could find, the KB, the docs, the cron examples (tried them *all*, including lynx and all those) and nothing seems to work. I've checked and rechecked passwords and CL usernames (tried root, cron, nobody and the PHPlist username). I'm stuck, and terribly frustrated. Any suggestions where to look for how to get this working?

Phplist has been a great script, if not for this one issue that seems to be a problem for so many users...no easy answer, I suppose, but a hint would be great. ;)
bear
phpList newbie
 
Posts: 4
Joined: 8:40pm, Sat 05 Feb, 2005

Postby bear » 3:25pm, Sat 19 May, 2007

Got it working.
viewtopic.php?p=8040#8040
I swear I'd tried this, but when I did it a second time it finally worked. Must have been something I'd failed to do properly the first time.

Apologies for the severely truncated URL. I don't have enough posts to do it properly due to forum restrictions.
bear
phpList newbie
 
Posts: 4
Joined: 8:40pm, Sat 05 Feb, 2005

Postby bear » 4:01pm, Sat 19 May, 2007

One further note, most of the suggested fix is superfluous and will actually generate an error in the cron email even though it executes properly. Only the USER assignment is needed (the red and bold text).
# Check the USER variable is set
if [$USER]; then
echo found USER variable
else
USER=listprocessor
export USER

fi
bear
phpList newbie
 
Posts: 4
Joined: 8:40pm, Sat 05 Feb, 2005

Postby H2B2 » 5:49pm, Mon 21 May, 2007

bear wrote:
# Check the USER variable is set
if [$USER]; then
echo found USER variable
else
USER=listprocessor
export USER

fi

Yes, cafamily's post is quite useful. You should find his solution, as well as other commandline script examples in the docs: http://docs.phplist.com/CommandLineScriptExamples

Another interesting post by theloft101 suggests fixing the user environment issue this way:
theloft101 wrote:in README.commandline it says:

"The normal PHPlist access restrictions are bypassed, but the Unix users who are allowed to run the script should be mentioned in the "commandline_users" config variable. The identity of a user is determined by the USER environment variable, which may not always match your system."

The solution is to uncomment line #137:
#$commandline_users = array();

and thereby work around it. But then you are not verifying the identity of the shell user accessing the script. If you still want the validation to take place, here's a hack to facilitate this:

1. First you will have to determine the key in the array $_SERVER that contains your server login name. Phplist assumes it to be "USER". I found mine was "LOGNAME", not "USER".

2. You can do this with the following PHP code added to [pathtophplist]/admin/index.php on line 64:
print_r($_SERVER); die;
upload the file and then execute it from the commandline. You should see a printout of the server array. Look for the server username and find it's associated key. For me this was "LOGNAME"

3. now delete line 64 which you just added in step 2.

4. just after (line 136) in config.php

# or you can use the following to disable the check (take off the # in front of the line)
#$commandline_users = array();

add the following three lines:

#you may need to change this to something else if your server enviroment uses a $_SERVER key other than USER
#$commandline_user_key="USER";
$commandline_user_key="LOGNAME";

REPLACE LOGNAME WITH THE KEY YOU DISCOVERED IN #2.

5. Finally in /admin/index.php replace all:

$_SERVER["USER"]
with
$_SERVER[$GLOBALS["commandline_user_key"]]

there should be 3 instances.

That should fix it and you now have server user validation back!

Ref: http://forums.phplist.com/viewtopic.php?t=9856
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006


Return to Question & Problems - after installing

Who is online

Users browsing this forum: No registered users and 6 guests