【问题标题】:Cakephp error messages might be my .htaccess fileCakephp 错误消息可能是我的 .htaccess 文件
【发布时间】:2012-07-31 10:12:41
【问题描述】:

我试图让这个 cakephp 项目在我的本地主机上运行,​​但总是收到一些错误消息

我收到此错误消息:

警告:include(Cake\bootstrap.php) [function.include]:无法打开流:第 77 行的 C:\wamp\www\cts\app\webroot\index.php 中没有这样的文件或目录

警告:include() [function.include]:无法打开“Cake\bootstrap.php”以包含(include_path='C:\wamp\www\cts\lib;.;C:\php\pear')在第 77 行的 C:\wamp\www\cts\app\webroot\index.php 中

致命错误:找不到 CakePHP 核心。检查 APP/webroot/index.php 中 CAKE_CORE_INCLUDE_PATH 的值。它应该指向包含你的 \cake 核心目录和你的 \vendors 根目录的目录。在第 86 行的 C:\wamp\www\cts\app\webroot\index.php 中

结束

代码* 索引.php 文件:

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    if (function_exists('ini_set')) {
        ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
    }
    /**line 77**/
    if (!include('Cake' . DS . 'bootstrap.php')) {
        $failed = true;
    }
} else {
    if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
        $failed = true;
    }
}

if (!empty($failed)) {
    /**line 86**/
    trigger_error("CakePHP core could not be found.  Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}

文件结束

【问题讨论】:

    标签: php mysql cakephp


    【解决方案1】:

    检查 index.php 的第 59 行,您会看到类似的内容

    //define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
    

    取消注释该行,如果它不起作用,则将完整路径硬编码到您的 lib/ 文件夹,该文件夹包含一个包含所有 CakePHP 库的 Cake 文件夹。

    【讨论】:

    • 我取消注释后的新错误消息:警告:include(C:\wamp\www\cts\lib\Cake\bootstrap.php) [function.include]: failed to open stream: No such file或第 81 行 C:\wamp\www\cts\app\webroot\index.php 中的目录
    • lib/ 文件夹的完整路径给了我 500 条内部错误消息
    • 我告诉过你,如果失败,请尝试将该常量的值硬编码到 Cake 文件夹所在的正确路径
    • @Dale 如果这是 apache 错误,请检查日志。这可能是 htaccess 的问题,或者只是由于服务器配置错误而导致的 php 错误。
    • //define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');将其更改为:define('CAKE_CORE_INCLUDE_PATH', '/full/path');
    【解决方案2】:

    如果要将 CakePHP 项目从一个目录复制到另一个目录,请确保复制所有必需的目录。

    当我将我的项目从旧目录复制到新目录时,我错误地忽略了 CakePHP 的 /lib 目录,认为它包含不必要的 git 或日志文件。

    我错了,将/lib 目录复制到新项目目录解决了我的致命错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 2013-07-18
      相关资源
      最近更新 更多