By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,776 Members | 1,127 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,776 IT Pros & Developers. It's quick & easy.

cronjob and php problem

P: 5
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:

Expand|Select|Wrap|Line Numbers
  1. *      *       *       *       *       /Users/mauro/Sites/phpTests/croned/croned.php
  2.  
  3. error reported 1:
  4. /Users/mauro/Sites/phpTests/croned/croned.php: line 1: ?PHP: No such file or directory
  5. /Users/mauro/Sites/phpTests/croned/croned.php: line 2: syntax error near unexpected token `('
  6. /Users/mauro/Sites/phpTests/croned/croned.php: line 2: `$date = date("l dS \of Ffclose($printout);'date); xt", "a"); 
  7.  
  8. error reported 2:
  9. /Users/mauro/Sites/phpTests/croned/croned.php: line 1: ?PHP: No such file or directory
  10. /Users/mauro/Sites/phpTests/croned/croned.php: line 2: syntax error near unexpected token `('
  11. fclose($printout);'date); xt", "a"); oned.php: line 2: `$date = date("l dS \of F Y h:i:s A");
  12.  
Expand|Select|Wrap|Line Numbers
  1. *      *       *       *       *       http://localhost/~mauro/phpTests/croned/croned.php
  2.  
  3. error reported
  4. /bin/sh: line 1: http://localhost/~mauro/phpTests/croned/croned.php: No such file or directory
  5.  
Expand|Select|Wrap|Line Numbers
  1. *      *       *       *       *      /usr/bin/php http://localhost/~mauro/phpTests/croned/croned.php
  2.  
  3. error reported
  4. Could not open input file: http://localhost/~mauro/phpTests/croned/croned.php
  5.  
Expand|Select|Wrap|Line Numbers
  1. *      *       *       *       *      /usr/bin/php  /Users/mauro/Sites/phpTests/croned/croned.php
  2.  
  3. doesn't even sent me an email!
  4.  
Feb 4 '08 #1
Share this Question
Share on Google+
2 Replies

P: 5
... and just in case this can be of any use:
Expand|Select|Wrap|Line Numbers
  1. X-Cron-Env: <SHELL=/bin/sh>
  2. X-Cron-Env: <PATH=/usr/bin:/bin>
  3. X-Cron-Env: <LOGNAME=mauro>
  4. X-Cron-Env: <USER=mauro>
  5. X-Cron-Env: <HOME=/Users/mauro>
Feb 4 '08 #2

P: 5
this issues was solved here:

http://forums.macosxhints.com/showthread.php?p=448624#post448624
Feb 5 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.