加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

PHP Cron作业:包含文件不工作?

发布时间:2020-05-26 01:54:17 所属栏目:PHP 来源:互联网
导读:我每晚都会运行一个cron作业,但由于某种原因,它说我尝试包含的文件是不存在的: Warning: require(../includes/common.php): failed to open stream: No such file or directory in /home/fini7463/public_html/cron/journeyNotifications.php on line

我每晚都会运行一个cron作业,但由于某种原因,它说我尝试包含的文件是不存在的:

Warning: require(../includes/common.php): failed to open stream: No such file or directory in /home/fini7463/public_html/cron/journeyNotifications.php on line 2
Fatal error: require(): Failed opening required '../includes/common.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/fini7463/public_html/cron/journeyNotifications.php on line 2

这是代码:

set_include_path('/home/fini7463/public_html/includes/');
require 'common.php';

‘common.php’文件的位置如下

public_html => cron     => journeyNotifications.php
            => includes => common.php

我甚至设置了包含路径(如代码所示),但我仍然收到此错误.问题是什么?

谢谢!

如果确实需要(‘../ includes / common.php’),则相对于当前工作目录遍历路径.

如果确实需要(‘common.php’),则在include路径中以及调用require()的脚本目录中搜索文件.

要解决此问题,请首先更改crontab中的目录:

cd /home/fini7463/public_html; php -f cronjob.php

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读