Cron Job无法打开流:没有这样的文件或目录

时间:2015-04-14 03:49:38

标签: php cron

INCLUDE './config/databases.php';
require './vendor/phpmailer/phpmailer/PHPMailerAutoload.php';

当我从浏览器执行此脚本时,我没有收到任何警告/问题。 但是当我为Cron工作添加相同的脚本时

Warning: include(./config/databases.php): failed to open stream: No such file or directory in /home/webdir/public_html/corn_mail.php on line 2

Warning: include(): Failed opening './config/databases.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/webdir/public_html/corn_mail.php on line 2

Warning: require(./vendor/phpmailer/phpmailer/PHPMailerAutoload.php): failed to open stream: No such file or directory in /home/webdir/public_html/corn_mail.php on line 3

Fatal error: require(): Failed opening required './vendor/phpmailer/phpmailer/PHPMailerAutoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/webdir/public_html/corn_mail.php on line 3

也尝试从./config/databases.php更改为/home/webdir/public_html/config/databases.php仍然相同。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

尝试删除./ - config/databases.php,如果vendor位于同一文件夹中,则vendor/phpmailer/phpmailer/PHPMailerAutoload.php。无需./