cronjob and php problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mauricioarango
    New Member
    • Jan 2008
    • 5

    #1

    cronjob and php problem

    Hi
    I'm trying to run an scheduled php script using cronniX on mac os x. So far I haven't got much promising results, but i think i'm close to it.

    I'm not familiar at all with Terminal and its language syntax so I've been pulling resources from all over the web to figure out what's going on.

    The test php script all it does is to write a time stamp on a text file. It works well when I run it manually from localhost. both the php and txt files are set to permission # 777.

    Now when I run this as a cronjob i get a series of errors mailed to me. I've tried different options for the cronjob, all of them failing.

    If someone with more knowledge on this area could look into this and give me some hints I would really appreciate it. I am sure some of these errors are trivial to you.

    Here are my different attempts and the errors mailed:

    Code:
    *      *       *       *       *       /Users/mauro/Sites/phpTests/croned/croned.php
    
    error reported 1:
    /Users/mauro/Sites/phpTests/croned/croned.php: line 1: ?PHP: No such file or directory
    /Users/mauro/Sites/phpTests/croned/croned.php: line 2: syntax error near unexpected token `('
    /Users/mauro/Sites/phpTests/croned/croned.php: line 2: `$date = date("l dS \of Ffclose($printout);'date); xt", "a"); 
    
    error reported 2:
    /Users/mauro/Sites/phpTests/croned/croned.php: line 1: ?PHP: No such file or directory
    /Users/mauro/Sites/phpTests/croned/croned.php: line 2: syntax error near unexpected token `('
    fclose($printout);'date); xt", "a"); oned.php: line 2: `$date = date("l dS \of F Y h:i:s A");
    Code:
    *      *       *       *       *       http://localhost/~mauro/phpTests/croned/croned.php
    
    error reported
    /bin/sh: line 1: http://localhost/~mauro/phpTests/croned/croned.php: No such file or directory
    Code:
    *      *       *       *       *      /usr/bin/php http://localhost/~mauro/phpTests/croned/croned.php
    
    error reported
    Could not open input file: http://localhost/~mauro/phpTests/croned/croned.php
    Code:
    *      *       *       *       *      /usr/bin/php  /Users/mauro/Sites/phpTests/croned/croned.php
    
    doesn't even sent me an email!
  • mauricioarango
    New Member
    • Jan 2008
    • 5

    #2
    ... and just in case this can be of any use:
    Code:
    X-Cron-Env: <SHELL=/bin/sh>
    X-Cron-Env: <PATH=/usr/bin:/bin>
    X-Cron-Env: <LOGNAME=mauro>
    X-Cron-Env: <USER=mauro>
    X-Cron-Env: <HOME=/Users/mauro>

    Comment

    • mauricioarango
      New Member
      • Jan 2008
      • 5

      #3
      this issues was solved here:

      http://forums.macosxhi nts.com/showthread.php? p=448624#post44 8624

      Comment

      Working...