I have a PHP script that I need to run every minute. I have made sure that the script works from the command line, and I'm using absolute paths to avoid any environment issues:
/usr/bin/php -q /var/www/myapp/services/myservice.php
Manually running that as root from the command line works fine, as I can see from the log file that my script writes to. To be sure, the script has execute permissions as well.
However, when placing the same exact command in a cron:
* * * * * /usr/bin/php -q /var/www/myapp/services/myservice.php
It does not run or at least it appear so. I've tried redirecting the output to another log file too:
* * * * * /usr/bin/php -q /var/www/myapp/services/myservice.php >> /mylog.log 2>&1
Still nothing. I have no indication whatsoever of the script being ran. I guess it doesn't, but I have no idea what else to look for. I even restarted the cron daemon.
I know there are similar questions on StackOverflow, but none of the answers turned out to be a solution for me. This is literally driving me crazy, I will greatly appreciate any help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…