Page 1 of 2

SOLVED Cron user must now be a superuser; Send not happening

PostPosted: 10:58pm, Fri 16 Aug, 2013
by ianellis
<Editted to a brief summary now solution is known - read last entry in thread>

I found cron needs a different command to run in 3.0 than was previously working in 2.x when on a server running php-cgi (the only option on a shared server.)

Symptom:
Cron was returning an emailed error report "access denied."
Promoted the cron user to a superuser.
The report then gave: "Processing queued campaigns." but didn't send

Re: Cron user must now be a superuser; Send not happening

PostPosted: 10:40am, Sat 17 Aug, 2013
by duncanc
Does the cron job run php-cli or php-cgi?

I think that the way processqueue works has been redesigned and now using php-cgi in a cron job now doesn't work. If that is the case then use php cli for the cron job.

Re: Cron user must now be a superuser; Send not happening

PostPosted: 2:30pm, Sat 17 Aug, 2013
by ianellis
<editted for brevity>

Fear not. There remains a pathway through the new script that accommodates also cgi version of php. See end of thread.

My ISP was firm about no use of cli php for reason of security of other users on the server. However, no problem, cgi version will work.

Re: Cron user must now be a superuser; Send not happening

PostPosted: 11:39am, Sun 18 Aug, 2013
by duncanc
php cgi can be used in a cron job, but the problem is that the code in processqueue has been redesigned so that it relies on javascript being executed by the browser.

Presumably your current cron command is something like
Code: Select all
php /xxxx/lists/admin/index.php page=processqueue login=yyyy password=xxxx

Looking at the phplist code, this command might avoid the use of javascript
Code: Select all
php /xxxx/lists/admin/index.php page=pageaction action=processqueue ajaxed=false login=yyyy password=xxxx


If you can use php cli then that uses a different path in the code that does not use javascript.
Despite what your hosting company says, try some of these in a cron job to see if you do have access to php cli. These will create a file in your home directory. If one works then it will show details of the php version.

Code: Select all
php-cli -v >~/phpver.txt
php5 -v >~/phpver.txt

Re: Cron user must now be a superuser; Send not happening

PostPosted: 2:16pm, Sun 18 Aug, 2013
by ianellis
<editted for brevity>

That's almost the answer. But remove reference to the ajaxed argument. It merely needs to be empty. "false" is never tested in the script, only empty.

Re: Cron user must now be a superuser; Send not happening

PostPosted: 4:14pm, Sun 18 Aug, 2013
by duncanc
I managed to process the message queue by removing ajaxed=false from the command. So

Code: Select all
php /xxxx/lists/admin/index.php page=pageaction action=processqueue  login=yyyy password=xxxx

I am guessing that this will behave as processqueue used to, so it will send only "batch size" emails then exit. When the cron job next runs then the next batch will be sent.

Re: Cron user must now be a superuser; Send not happening

PostPosted: 4:36am, Mon 19 Aug, 2013
by ianellis
Yes! That's it. I reached that conclusion independently by reading the relevant parts of the scripts.

The bottom line for the next poor smuck that finds cron quit in 3.0, here's the holy grail: new syntax as above:

If 2.x worked with cron setup using
.../admin/index.php page=processqueue login=yyyy password=xxxx

then 3.0 will work now using
.../admin/index.php page=pageaction action=processqueue login=yyyy password=xxxx

Reason: the new concept of the processqueue script has been split between two directories. Most of it is now in a new "action" directory.

I've successfully made a test run. Messages delivered properly to my monitoring email addresses. To deal with stalling, I fire the cron every 15 minutes, but may reduce that to 10, or tweak a setting in the config.php

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 5:25pm, Wed 21 Aug, 2013
by jeffschips
Okay really frustrated.

In php < 3.0 was able to use:

/usr/local/bin/php /home/mydo/public_html/lists/admin/index.php -p processqueue > /dev/null 2>&1

Now that does not work nor do the recommendations listed here. I never had to use a login/password combination. I believe on some shared hosting accounts the password/login names are visible from other accounts. Nevertheless, when I attempt to use the login/password method, still no go.

I'm pulling out my hair and customer is requesting emails go out pronto!

Help

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 5:49pm, Wed 21 Aug, 2013
by duncanc
You are using php-cli, so the original problem and solution are not relevant.

What error message are you getting? If none then change your command to capture the output instead of discarding it.
Code: Select all
/usr/local/bin/php /home/mydo/public_html/lists/admin/index.php -p processqueue >~/processqueue.log 2>&1

The output will go to a file processqueue.log in your home directory, /home/mydo

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 6:02pm, Wed 21 Aug, 2013
by jeffschips
Thank you!

There is only one sentence in the log file:

cannot find config file


That's it.

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 7:58pm, Wed 21 Aug, 2013
by duncanc
It appears that in phplist 3 you need to specify the location of the config file in the command.
So if the config file is in the default location then your command should be:
Code: Select all
/usr/local/bin/php /home/mydo/public_html/lists/admin/index.php -p processqueue -c /home/mydo/public_html/lists/config/config.php >~/processqueue.log 2>&1

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 8:12pm, Wed 21 Aug, 2013
by jeffschips
Bingo!

Success!

Thanks for your help it might be useful for a moderator to suggest that tiny fact (that a path to config file is required to be included in cron job commands) in the documentation.

thanks again!

Re: Send not happening

PostPosted: 5:38pm, Sun 01 Sep, 2013
by geminorum
Hi,

i tried lots of methods to run cron, but none of them works.

For example:

Code: Select all
/usr/local/cpanel/3rdparty/bin/php -q /home/user/public_html/phplist/admin/index.php -p processqueue -c /home/user/public_html/phplist/config/config.php>/home/user/public_html/phplist/processqueue.log 2>&1


returns nothing. The file (processqueue.log) is empty.

I also try:

Code: Select all
/usr/local/cpanel/3rdparty/bin/php -q /home/user/public_html/phplist/admin/index.php page=processqueue login=admin password=xxx>/home/user/public_html/phplist/processqueue.log


returns only one line (in processqueue.log): Cannot find config file.

Phplist version: 3.0.2
PHP version:
PHP 5.3.17 (cli) (built: Apr 12 2013 10:46:56)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.

What did I do wrong? :shock:

Thanks!

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 6:43pm, Sun 01 Sep, 2013
by duncanc
Which command did you run to get the php version details?

Re: SOLVED Cron user must now be a superuser; Send not happe

PostPosted: 6:52pm, Sun 01 Sep, 2013
by geminorum
command used:
Code: Select all
/usr/local/cpanel/3rdparty/bin/php -v>/home/user/public_html/phplist/phpver.txt