Plesk PHP cron task - HELP PLEEEEEASE!!!!!

Discussion in 'PHP' started by willbinks, Mar 26, 2010.

  1. #1
    Ok... i have spent the last 8 hours going nuts trying to get a scheduled task to run on my plesk server!!
    someone please help me!!!

    I have run:

    echo exec("which php");

    to get my path to php ... which i am told is /usr/bin/php

    so i have made my cron task look like this:

    /usr/bin/php -q /var/www/vhosts/mydomainname.com/httpdocs/folder1/task.php

    NOT WORKING !!!! why??

    I seem to remember going through this same problem before and i think the path to php was something else in plesk. but surely if this is the path given to me by
    echo exec("which php");

    it should be right no?
     
    willbinks, Mar 26, 2010 IP
  2. willbinks

    willbinks Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ok.. i think the path to php must be correct but i am getting this:

    Could not open input file: /usr/local/psa/home/vhosts/mydomain.com/httpdocs/folder1/script.php

    and yes i did just put all permission to 777 on that file
     
    willbinks, Mar 26, 2010 IP
  3. pig2cat

    pig2cat Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #3
    it's probably because start directory for the user you're running is not / but /var/www/ or /usr/local/psa/whatever...

    an easy fix would be just to use curl
    /usr/bin/curl -s http://site.com/updater.php

    additionally you could htaccess block, or use $_server remote addr to only allow your own server to run the script
     
    pig2cat, Mar 27, 2010 IP