Trying to schedule a Cron to process queue on cpanel

Hi phplist forum

I’ve been trying to schedule a cron to process the queue by setting it up on cpanel, referencing this doc in phplist/manual and reading various forum posts but have had no joy yet.

As described in the phplist/manual doc I have create an executable (755) file named ‘phplist’ and placed it in the ‘bin’ folder at the top level of the website’s server space. For cross referencing this file is also in the ‘bin’ folder of the current phplist version 3.2.6 download.

The code in the file I uploaded reads as follows:

#!/bin/bash
php-cli /home/future/public_html/lists2/admin/index.php -c /home/future/public_html/lists2/config/config.php $*

I’ve been told by my hosting company that they “don’t give direct access to the servers via SSH as this is a shared platform” & wouldn’t give me any more info saying they don’t offer technical support. The phplist/manual doc says that the first line #!/bin/bash relates to “the shell that you want to use” so I’m not sure if that’s correct bearing in mind what the hosting company said? Any ideas?

In the line after I have changed /usr/bin/php to /usr/bin/php-cli from reading this forum string (check comment from DanWaterloo who seems to be very knowledgable ohm these things). I also changed the 2 paths to reflect what I believe (but not 100% sure) is correct for this particular domain to:

/home/future/public_html/lists2/admin/index.php
and
/home/future/public_html/lists2/config/config.php

where ‘future’ is my cpanelUserName and ‘lists2’ is the relevant phplist installation.

I then created a cron in cpanel with the following structure (as directed by the phplist/manual doc) as follows:

*/5	*	*	*	*	phplist -pprocessqueue > /dev/null 2>&1

which should process the queue once every 5mins.

However, I have a test email sitting in the queue and it’s not getting sent. Can anybody help me to get this to work? Any pointers &/or help would be most appreciated

Phil

@phillegg Don’t discard the output save it to a file in your home directory
replace

/dev/null 2>&1

by

~/processqueue.log 2>&1

Then there might be an explanation of what is not working.

Thanks Duncan

Have edited it, so my cron is now:

*/5	*	*	*	*	phplist -pprocessqueue > ~/processqueue.log 2>&1

Is that right, having ‘processqueue’ in the line twice!

Best

Phil

Hi Duncan

OK, it’s now produced a log file which says that the command is not found:

/usr/local/cpanel/bin/jailshell: phplist: command not found

Does the file path point towards a solution?

Best

Phil

@phillegg You need to use the full path to the phplist file. I guess that it is

/home/future/public_html/bin/phplist

but you should verify that

Sorry Duncan but I’m getting confused and wondering if you could help me.

The file path it mentions in the log created is:

/usr/local/cpanel/bin/jailshell: phplist: command not found

but you’ve mentioned:

/home/future/public_html/bin/phplist

I’m not sure on 2 things.
1st - Do I use the log’s file path or your suggested file path?
2nd - Where do I place the new file path?

Many thanks for any help you can give me with this

Phil

@phillegg In your cron command you need the full path to phplist, not just the file name.

phplist: command not found

So replace phplist by the full path as I gave (if that is actually correct).

Hi Duncan

OK, I’ve got my file paths correct now but have the following message in the message log.

X-Powered-By: PHP/5.4.45
Content-type: text/html

/data04/future/public_html/lists2/admin/index.php: line 1: ?php: No such file or directory
/data04/future/public_html/lists2/admin/index.php: line 3: syntax error near unexpected token `;'
/data04/future/public_html/lists2/admin/index.php: line 3: `@ob_start();'

This is presumably referencing the opening couple of lines in the index.php file, which I take to mean that the cron is triggering the command line but there’s something not right further down the chain.

Do you, (or anyone else) have an idea as to what i can try to correct this?

Many thanks for all your help with this

Phil

@phillegg It looks like the php file is being treated as a shell command file. If your path is now correct then this should work for the cron command

php-cli /data04/future/public_html/lists2/admin/index.php -c /data04/future/public_html/lists2/config/config.php -p processqueue >~/processqueue.log 2>&1