Trouble running cron job

Discussion in 'Site & Server Administration' started by guruguy, Jan 16, 2008.

  1. #1
    I have a program running via a cron job on my server, however instead of executing the script, it emails me the following

    ----------------
    /home/proxy/public_html/path/my_script.php: line 1: ?php: No such file or directory
    /home/proxy/public_html/path/my_script.php: line 2: syntax error near unexpected token `0'
    /home/proxy/public_html/path/my_script.php: line 2: ` set_time_limit(0);'
    ----------------

    So it is finding the script but it looks like it isn't running it as a php script. I am using the cpanel standard cron job function to run it, and just using the path to the script as the command. This is my first attempt at using a cron job so I have no idea what I'm doing wrong. Some help would be appreciated.
    Thanks
     
    guruguy, Jan 16, 2008 IP
  2. st1905

    st1905 Well-Known Member

    Messages:
    573
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    135
    #2
    Put the php -q command before the path to the script.

    /usr/bin/php -q /home/proxy/public_html/path/my_script.php
    Code (markup):
     
    st1905, Jan 16, 2008 IP
    guruguy likes this.
  3. guruguy

    guruguy Active Member

    Messages:
    553
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thanks alot. All works perfectly now
     
    guruguy, Jan 16, 2008 IP