PHP警告:include(/ var / www / html /....../ lib / Cake / Error / ErrorHandler.php):无法打开流错误 [英] PHP Warning: include(/var/www/html/....../lib/Cake/Error/ErrorHandler.php): failed to open stream Error

查看:278
本文介绍了PHP警告:include(/ var / www / html /....../ lib / Cake / Error / ErrorHandler.php):无法打开流错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试加载网页时遇到此错误。

I encountered this error when trying to load my webpage.

错误消息上显示的路径为

The path that was showed on the error message was,


PHP警告:
include(/var/www/html/test.com/www/products/abc/lib/Cake/Error/ErrorHandler.php):
无法打开流:

PHP Warning: include(/var/www/html/test.com/www/products/abc/lib/Cake/Error/ErrorHandler.php): failed to open stream:

由于
的路径为 / var / www / html,因此无法找到Cake库目录/test.com/products/abc/lib/Cake /...。

It wasn't able to locate the Cake library directory as the path should be "/var/www/html/test.com/products/abc/lib/Cake/..." instead.

有人知道如何解决此问题吗?

Any idea how I can fix this?

错误使我指向Core / App.php文件的第540行,即

The error was pointing me to line 540 of the Core/App.php file which is,

if ($file = self::_mapped($className, $plugin)) {
        return include $file;   <<---- LINE 540
}
$paths = self::path($package, $plugin);

谢谢!

推荐答案

您的CakePHP试图包含一个文件,就像您键入

Your CakePHP is trying to include a file just like if you typed

include '/var/www/html/test.com/www/products/abc/lib/Cake/Error/ErrorHandler.php';  

PHP:include-Manual


include结构将发出一个警告它找不到文件

The include construct will emit a warning if it cannot find a file

这里有趣的是您的CakePHP误解了您的根目录,所以一个主意是已使用诸如Composer之类的依赖项管理器进行安装,并将您的项目最初位于父目录<$ c下时移至 /var/www/html/test.com/www / $ c> /var/www/html/test.com / 。

The interesting thing here is that your CakePHP is missunderstanding your root directory, so an idea is that you have installed using a dependency manager such as Composer and moved your project into /var/www/html/test.com/www/ when was originally under the parent directory /var/www/html/test.com/.

为了确定,请检查Cake定义其ROOT目录的文件,该目录是根 index.php 文件。如果您查看内部,将会看到以下内容:

In order to make sure, check the file where Cake defines its ROOT directory, which is the root index.php file. If you look inside you'll see something like this:

define('ROOT', dirname(__FILE__)); // <-- ROOT GLOBAL VARIABLE DEFINITION
define('WEBROOT_DIR', 'webroot');
define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);  

它可以随框架的版本而变化,但是应该非常相似。

It can change with the version of the framework but it should be really similar.

我们要查找的行是第一行,这意味着设置了CakePHP的 ROOT 全局变量 index.php 所在的位置。

The line that we are looking for is the first one, that means the ROOT global variable from CakePHP is set where the index.php is located.

我的理论是,您已经移动,删除或修改了ROOT或其他过时的全局变量,而CakePHP找不到您发布的正确路径。

My theory is that you have moved, deleted or modified the ROOT or other trascendent global variables and CakePHP is not finding the correct path as you posted.

如果您需要更多信息,我将编辑此答案。另外,还将感谢您提供有关您的错误的更多信息,以便我能满足您的更多需求。

希望这对您有所帮助:)

If you need further information comment and I will edit this answer. Also a little bit more of information about your error will be appreciated so I can fit more your needs.
Hope this helped you :)

这篇关于PHP警告:include(/ var / www / html /....../ lib / Cake / Error / ErrorHandler.php):无法打开流错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆