我正在尝试通过 cron 运行 php 文件,但它不起作用。当我在浏览器中输入脚本的 url 时,它可以工作。所以我认为问题出在cron。我的操作系统是centOS。
这是 crontab。
* * * * * /usr/bin/php /var/www/htdocs/wordpress/text.php
text.php 的内容是 ""
来自 cron 的电子邮件说,
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Status: RO
Could not open input file: /var/www/htdocs/wordpress/text.php
这是“ls -l/var/www/htdocs”
-rw-r--r--. 1 root root 50 1 29 22:04 2014 index.html~
-rw-r--r--. 1 root root 22 1 29 22:04 2014 index.php
drwxr-xr-x. 13 root apache 4096 1 30 14:36 2014 phpmyadmin
drw-rw-rwx. 8 root root 4096 1 30 20:11 2014 wordpress
你能告诉我如何解决这个问题吗?
最佳答案
你错过了开始/
对于绝对路径:
* * * * * /usr/bin/php /var/www/htdocs/wordpress/text.php
关于php - cron centOS "Could not open input file"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21455959/