Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with php cronjob 1

Status
Not open for further replies.

farley99

MIS
Feb 12, 2003
413
US
My crontab reads as follows....
* * * * * /home/farley/question.php

But when I runs I get the error....
/bin/sh: /home/farley/question.php: Permission denied

Any tips on this?

Thanks in advance.
 
'Permission denied' on /home/farley/question.php?
Sounds like 'tip' to me! [grin]

Check permission and adjust accordingly - make your script executable:

ls -l /home/farley/question.php

man chmod

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks, it gives me these errors now though....
/home/farley/question.php: ?php: No such file or directory
/home/farley/question.php: =chris@farley.com: command not found
/home/farley/question.php: =chris@farley.com: command not found
/home/farley/question.php: =question: command not found
/home/farley/question.php: =Hi Farley: command not found
/home/farley/question.php: line 7: syntax error near unexpected token `mail($to,$subject,$body,&quot;From:$from&quot;)'
/home/farley/question.php: line 7: `mail($to,$subject,$body,&quot;From:$from&quot;);'

My code is as follows...
<?php

$to=&quot;chris@farley.com&quot;;
$from=&quot;chris@farley.com&quot;;
$subject=&quot;question&quot;;
$body=&quot;Hi Farley&quot;;
mail($to,$subject,$body,&quot;From:$from&quot;);

?>

(It runs fine when i do: php question.php )
 
You need to add
#!/usr/bin/php -q
to the top of your script.

Hope this helps.
 
>(It runs fine when i do: php question.php )
While not doing the same thing in your crontab ?
* * * * * php /home/farley/question.php

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top