2017-08-12 57 views
0

我得到试图打开,我就接手一个项目的索引文件时,出现以下错误:麻烦require_once未能打开流:没有这样的文件或目录

Warning: require_once(core_services/logging.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/app/docroot/www.website.com/index.php on line 7 

Fatal error: require_once(): Failed opening required 'core_services/logging.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/app/docroot/www.website.com/index.php on line 7 

的代码错误指的是这个样子的:

7 require_once "core_services/logging.php"; 
8 $logger=new syslog_class(__FILE__,LOG_DEBUG); 

我检查,以确保文件路径定义它,呼应回以及的logging.php在终端中的内容存在,并且返回就好了,当我得到当前的工作目录第6行,它返回/Applications/XAMPP/xamppfiles/htdocs/app/docroot/www.website.com,我假设它是定义我的根文件夹。

不确定如何去解决这个问题,如果任何人有任何想法的方法,我很乐意听到他们,因为我的PHP有点生疏,缺乏wordpress的上下文。

编辑:办法我试过到目前为止

require 'core_services/logging.php'; 
require '/core_services/logging.php'; 
require './core_services/logging.php'; 
require '../core_services/logging.php'; 
require '/Applications/XAMPP/xamppfiles/htdocs/app/docroot/www.website.com/core_services/logging.php'; 
require realpath(dirname(__FILE__)) .'/core_services/logging.php'; 
require(__DIR__"/../core_services/logging.php"); 

require_once 'core_services/logging.php'; 
require_once '/core_services/logging.php'; 
require_once './core_services/logging.php'; 
require_once '../core_services/logging.php'; 
require_once '/Applications/XAMPP/xamppfiles/htdocs/app/docroot/www.website.com/core_services/logging.php'; 
require_once realpath(dirname(__FILE__)) .'/core_services/logging.php'; 
require_once __DIR__"/../core_services/logging.php"; 

我也验证了它不是一个权限问题。

+0

尝试'require_once真实路径(目录名(__ FILE__)) '/ core_services /的logging.php';' – icecub

+0

这种方法没有运气,它返回相同的错误,得过且过。更新尝试的文件路径。 – jywbz

回答

0

尝试指定完整路径:

require './core_services/logging.php'; 
//OR 
require '/Applications/XAMPP/xamppfiles/htdocs/app/docroot/www.website.com/core_services/logging.php'; 
+0

这两种方法都不幸运。只有更新的文件路径才会出现相同的错误。 – jywbz

+0

您是在Windows还是Linux? – btc4cash

+0

Mac实际上,使用XAMPP – jywbz

相关问题