crontab, php: php script runs from command line, but not from crontab
I have verified that my php script runs from the command line, but it has n开发者_C百科ot been executed from the crontab (yet, I guess). Does it take a while for it to start working?
this is the crontab line:
00,15,30,45 * * * * php /var/www/download.php
I want it to execute everyday, every fifteen minutes starting at the top of the hour.
Most likely it is environment variable issue. First thing to check is whether cron user has php in its path?
Cron jobs don't have access to all the env variables set in user's profile. Better to redirect stdout and stderr to a file in your cron command like this:
*/15 * * * * php /var/www/download.php > $HOME/cron.out 2>&1
And then after 15 minutes examine $HOME/cron.out
why it failed.
*/15 * * * * php /var/www/download.php
if that fails, then your script is probably failing. permissions and what not. check the cron log.
精彩评论