My cronjob isn't working?
Maybe a silly question, but I'm trying to get a cronjob to work. Although this could be a question for serverfault I 开发者_StackOverflow社区think its also a SO-question.
Anyway: I have set up a cronjob to be executed everey 1 minute of every hour, day (number), day (name) and month. The given command is: /home/easybr01/domains/easybranding.nl/public_html/cronjobs/test.php
Which is nothing more than a file with a simpe php function mail(to, subj, content, hdrs)
to test if it works... but the mails never come in.. and they're not in a spam folder eighter..
Does someone know what's wrong?? I figured this should be pretty straight forward...
You should indicate ${PATH_TO_PHP} into the cronjob, like :-
* * * * * ${PATH_TO_PHP} /home/easybr01/domains/easybranding.nl/public_html/cronjobs/test.php
Alternatively, you can make the script executable (ex. mod 744),
and place #!${PATH_TO_PHP}
into first line of your PHP script, like :-
#!${PATH_TO_PHP}
<?php
// remanding code
?>
For starters, you need to run the PHP command-line interpreter, not just point to a PHP file. If you're giving a command to cron, it needs the whole command.
精彩评论