Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2006
    Posts
    19

    Default PHPList and Cron Jobs

    Hi,

    I've got PHPList installed and am having some trouble with setting up a cron job to process the message queue.

    I've edited PHPList's config so that it won't send over the server limit here at SiteGround. Basically, what I have to do at this point is log in to PHPList every hour and restart the process queue, otherwise it will time out and just won't finish sending a large list. I want to set up a cron job so that the cue will automatically be processed each hour and I can just click send in PHPList and not have to worry about the rest of the messages going out in time.

    I've read over the PHPList forums for a solution, but they're all for outdated versions of PHPList and I can't seem to figure out how to apply them to the new version and to SiteGround. I've followed the directions, but the cron job I set up seems to be having absolutely no effect at all.

    Since I know nothing about cron jobs, could someone help tell me what to do to set up a cron job to automatically process the message queue?

    Thanks!

  2. #2
    Join Date
    Mar 2006
    Posts
    19

    Default

    Ahh, I got some help for this on the PHPList forum, so now I think I have it set up properly... but I'm getting another problem here...

    When I tell it to run, I get an error that says "No such file or directory" ... It's pointing to the right file, so I don't know why it says this... any ideas?

  3. #3
    Join Date
    Mar 2006
    Posts
    19

    Unhappy

    I've played around with it a little bit more, but I can't get past the "no such file or directory" problem. I can tell it's reading the file, but for some reason it's not able to understand it. Here is the error message I get:

    /home/jasgp/public_html/newsletter/admin/index.php: line 1: ?php: No such file or directory
    /home/jasgp/public_html/newsletter/admin/index.php: line 3: syntax error near unexpected token `;'
    /home/jasgp/public_html/newsletter/admin/index.php: line 3: `@ob_start();'
    I'm using the same cron job that many people with PHPList are using, so I'm not sure why it's not working for me... I hope someone reads this and can help out.

  4. #4
    Join Date
    Jun 2005
    Posts
    133

    Default

    Fantastico can now install phpList and automatically configure it to process the message queues with a cron job. Just go to cPanel -> Fantastico -> phpList, fill in the details and install the application. The cron will be automatically set up.

    Make sure you have MAILQUEUE_BATCH_SIZE and MAILQUEUE_BATCH_PERIOD set appropriately in config/config.php, so that no more than 400 messages are sent per hour. For example:

    define("MAILQUEUE_BATCH_SIZE",60);

    define("MAILQUEUE_BATCH_PERIOD",600);

    Also, configure the cron job to run every 5 or 10 minutes. Thus, the mails will be dispatched in portions of 60 messages, every 10 minutes. It is better to have the cron running more frequently, and sending a few messages each time, than have it run once an hour, and send a truckload. DO NOT configure the cron to run too often, without altering the MAILQUEUE_BATCH_ options.

    The command of the cron job will be something similar to this:

    cd '/home/USERNAME/public_html/list/admin/' ; php -q index.php -p processqueue > /dev/null ;

    You should not worry about it though, Fantastico will configure it for you.

  5. #5
    Join Date
    Jun 2005
    Posts
    133

    Default Aha!

    The cron does not work for you, because you are trying to execute the PHP script as a shell script -- the Bash interpreter is having trouble with that

    Can you paste the command line fron the cron editor? I believe I can fix that...

  6. #6
    Join Date
    Mar 2006
    Posts
    19

    Default

    Hey Kenny,

    Thanks a lot for your help. I'm starting to understand this a bit better now... I've tried your instructions and a tip I got from the PHPList fortums as well. Here are the two different cron tabs I tried:

    cd '/home/jasgp/public_html/newsletter/admin/' ; php -q index.php -p processqueue -c /home/jasgp/public_html/newsletter/config/config.php > /dev/null ;
    curl 'http://www.jasgp.org/newsletter/admin/index.php?page=processqueue&login=USERNAME&passwor d=PASSWORD' > /dev/null ;
    I've had only one successful test run with this so far, for some strange reason. It was when I first tried out the curl command, without the > /dev/null at the end.

    Since then, I've tried it with the > /dev/null, and I've tried the top one (the one you gave me), and I've tried the bottom one again without the ? /dev/null.

    The strange thing that's happening now is that the queue seems to be processing, but I'm not getting any of the test emails! When I check the PHPList queue, it seems to have successfully run... but I haven't recieved the test email at any of the addresses I sent it to... it only happened that first time. I checked my spam filters, and its not going in to them, so I have no idea why I'm not recieving them anymore.

    When the queue is processed with the 'cd' command, I recieve at email to my admin address that has the following lines in it:
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed

    100 3807 0 3807 0 0 16564 0 --:--:-- --:--:-- --:--:-- 16564
    When the queue is processed with the 'curl' command, I recieve a similar email, but it's followed by a lot of html code. It looks like its emailing me the PHPlist: Send message queue webpage.

    I'm totally perplexed! Especially because it worked once, and now its behaving oddly! Any ideas?

    (Oh, and thanks for the tip about batch sizes... I had it set to 300 emails every 3600 seconds, but 60 every 600 seconds makes much more sense.)

  7. #7
    Join Date
    Mar 2006
    Posts
    19

    Default

    Edit: Solved. Sorta...

    I figured out why I was recieving mysterious emails, and why I couldn't get test emails... it's because of how PHPList's requeue feature works... I tried sending it with a new email and it worked.

    I cant get it to work with the cd command, but it works OK with the curl command. :-)

Similar Threads

  1. Drupal Cron jobs
    By klemons in forum Other Software and Applications
    Replies: 3
    Last Post: 05-12-2009, 09:38 AM
  2. Cron Jobs and Sourceguardian
    By drpforum in forum Hosting Related Questions
    Replies: 4
    Last Post: 01-30-2008, 06:09 AM
  3. Need help w/ PHPList Cron Job
    By jrosenburg in forum Other Software and Applications
    Replies: 2
    Last Post: 08-05-2006, 01:01 PM
  4. Cron for PHPList
    By squigon in forum Forum Applications
    Replies: 1
    Last Post: 12-13-2005, 02:07 AM
  5. CRON Jobs and CPU Loads
    By turscak in forum Customers' experience and suggestions
    Replies: 5
    Last Post: 12-05-2005, 05:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •