Php Crontab和路径
这是我的crontab:Php Crontab和路径,php,path,cron,Php,Path,Cron,这是我的crontab: SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin MAILTO="" # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/s
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
# PHP Script
26 16 * * * root /usr/bin/php /var/www/script.php
#
如果存在in-path变量,为什么还要放置完整的php路径(/usr/bin/php)?否则脚本将无法工作。因为crontab在user下运行,user的其他值为
PATH
。有关更多信息:但是为什么在cronfile中指定了PATH变量?