Running a cron and getting errors

Discussion in 'Site & Server Administration' started by Henny, Mar 27, 2006.

  1. #1
    Does anyone see anything here?

    the cron I am running is this:

    /home/myuser/public_html/folder/cron.php

    But I get this error:

    /home/myuser/public_html/ups/cron.php: line 1: ?php: No such file or directory
    /home/myuser/public_html/ups/cron.php: line 2: syntax error near unexpected token `"config.php"'
    /home/myuser/public_html/ups/cron.php: line 2: `require_once("config.php");'


    If I open the file cron.php in my web browser, it executes flawlessly. All I want cron to do is basically open the file...
     
    Henny, Mar 27, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    /folder and /ups are the same (i.e. a typo in this thread)?

    The ?php seems to suggest it has troubles parsing PHP. Try instructing it explicitly to parse through php:

    php -q /home/...etc...

    If on windows, add this to the first line of the script:

    #!/usr/local/bin/php -q
     
    T0PS3O, Mar 27, 2006 IP
  3. Henny

    Henny Peon

    Messages:
    2,118
    Likes Received:
    241
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Whoah! You lost me :D

    Yes, that was a typo in the thread.

    so I add "php -q " before the cron?

    Yes, linux
     
    Henny, Mar 27, 2006 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, before the cron command.
     
    T0PS3O, Mar 27, 2006 IP
    Henny likes this.
  5. Henny

    Henny Peon

    Messages:
    2,118
    Likes Received:
    241
    Best Answers:
    0
    Trophy Points:
    0
    #5
    OK, I will give that a shot. Thanks Tops, will report back tomorrow :)
     
    Henny, Mar 27, 2006 IP
  6. Henny

    Henny Peon

    Messages:
    2,118
    Likes Received:
    241
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Tops, thank you, that worked a charm!
     
    Henny, Mar 28, 2006 IP
  7. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Cool, TOPS to the rescue :cool: :D

    Crons are quite a mystery - took me some time to work it all out as well...
     
    T0PS3O, Mar 28, 2006 IP