http://www.tequilafish.com/2005/11/17/phplist-with-crontab-user-environm...

the modules/massmailer/engines/phplist/bin/phplist file must define a USER=drupal and Export USER

The Drupal variable table must have a phplist_command_line_user set to s:6:"drupal".

$result = Sql_fetch_array(Sql_query("SELECT value FROM ". $db_info['prefix']."variable WHERE name = 'phplist_command_line_user'"));

CommentFileSizeAuthor
#5 phplist_0.patch1.04 KBkilles@www.drop.org

Comments

killes@www.drop.org’s picture

I doubt that this applies to massmailer as we use Drupal's cron mechanism not phplist's. Also, I think that setting it to "drupal" will not work in any case. I guess it needs to be set to te respective unix user. Either that owning the files or the one running the process.

mfb’s picture

With a fresh install of civicspace-0.8.2, the error I get on admin/massmailer/queue is:
PHPlist version 2.10.2 (c) 2000-2005 Tincan Ltd, http://www.phplist.com

Error: Sorry, You (drupal) do not have sufficient permissions to run phplist on commandline

my phplist_command_line_user was set to N; for some reason:
mysql> select * from variable where name like '%phplist%';
+---------------------------+-------+
| name | value |
+---------------------------+-------+
| phplist_command_line_user | N; |
+---------------------------+-------+

If I run:
mysql> update variable set value='s:6:"drupal";' where name = 'phplist_command_line_user';

I get:
PHPlist version 2.10.2 (c) 2000-2005 Tincan Ltd, http://www.phplist.com
Started
Script stage: 6
Finished, Nothing to do
Finished, All done

But if I change the massmailer settings at admin/settings/massmailer, the phplist_command_line_user is reset to N;

killes@www.drop.org’s picture

I'll look into it. I am wondering why settign it to "drupal" might do any good, though. It is unlikely that such a user exists on your system.

killes@www.drop.org’s picture

variable_set('phplist_command_line_user', $_SERVER["USER"]);

This code is what sets the phplist_command_line_user variable. This code is buggy, as $_SERVER["USER"] is not set for all servers.

killes@www.drop.org’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

Here's a patch, anybody care to test it?

Veggieryan’s picture

didnt work for me..
i revisited settings>massmailer and saved...
went back to massmailer>send mail
still get the
PHPlist version 2.10.2 (c) 2000-2005 Tincan Ltd, http://www.phplist.com

Error: Sorry, You (drupal) do not have sufficient permissions to run phplist on commandline

this is on a cpanel shared host.. no shell access... cs .8.2

hmm,
will try that user hack next...
unless someone has a better idea
it will be a great day when i get this one working....

stefanoq’s picture

I tried setting the variable manually and the error message went away. Instead I get this:

PHPlist version 2.10.2 (c) 2000-2006 Tincan Ltd, http://www.phplist.com
Started
Script stage: 6
Finished, Nothing to do
Finished, All done

Unfortunately, there are messages queued that the script is not finding. Any suggestions?

stefanoq’s picture

Never mind. Just a problem with the date. THe manual workaround inserting s:6:"drupal" in the variable table works for me!

ToddZ-1’s picture

Title: User Environment variable must be set in PHP List 2.10.2 » Worked for me, too

Just to chime in, I just had the exact same "permissions" problem with a new CivicSpace install, and entering s:6:"Drupal"; in the variable table also got my mail going.

gerhard killesreiter’s picture

Can somebody please try eomting else besides Drupal as the magic codeword? I really do not understand why specifically "Drupal" would make it send mail.

webchick’s picture

Title: Worked for me, too » User Environment variable must be set in PHP List 2.10.2
Amazon’s picture

Gerhard, the Drupal magic keyword works because we hardcoded that at the unix user in the configuration file.

PHPList then looks for that unix user called Drupal in the variables table, finds it and then runs sucessfully. This is clearly something that needs to be cleaned up.

Kieran

davidallen’s picture

How do you 'hard code' / what is the format of the variable insertion of 's:6:"drupal";' into the statement ... variable_set('phplist_command_line_user', ....

Evan Leeson’s picture

I did this. I reset the variable to s:6:"Drupal"; using PHPMyAdmin. No change in my status. Is there another step I need to take? Some sort of session restart or something? It is getting very frustrating when identical steps have different outcomes.

Amazon’s picture

You need to add this to modules/massmailer/engines/phplist/bin/phplist

USER=drupal
export USER

Kieran

PunkCut25’s picture

Assigned: Amazon » PunkCut25

heres the php code I used to set this variable

<?php

db_query("insert into variable set value='s:6:\"drupal\";' where name = 'phplist_command_line_user'");

?>
PunkCut25’s picture

Make sure you set the serialized number correctly

s:6:'drupal'

6 characters in drupal

you should set this to a user on your filesystem which as permissions to run php-cli or php

to test this goto your CLI

and type 'php' or 'php-cli'

if both are executed without an access denied error.

Then just set this to

s:$num_of_characters:$your_user_name

stefanoq’s picture

I figured out that each time I save new massmailer settings it resets the phplist_command_line_user row to 'N;'. Anybody know why?

killes@www.drop.org’s picture

I've removed that variable_set statement for now. It always works for me without it, but never with it...

dalin’s picture

Things were working fine for me, then I went to admin/settings/massmailer and now all is kaput.

Changing the variable phplist_command_line_user (and USER in modules/massmailer/engines/phplist/bin/phplist) to either 'drupal', a real user, or "" does not fix things.

How can we get massmailer working again?

killes@www.drop.org’s picture

download the latest version of the module, delete the variable from the variables table and refresh the cache.