【问题标题】:Where [how ?] is the path for lib/Cake/Error/ErrorHandler.php defined?lib/Cake/Error/ErrorHandler.php 的路径在哪里定义?
【发布时间】:2016-08-22 08:37:44
【问题描述】:

下载项目。从在线服务器并尝试在我的本地主机中运行它,但我遇到了路径问题。我没有看到路径是在哪里定义的,但是,我得到了错误:

[Mon Aug 22 14:12:10.681539 2016] [:error] [pid 1186] [client 127.0.0.1:47932] PHP Warning:  include(/home3/username/public_html/lib/Cake/Error/ErrorHandler.php): failed to open stream: No such file or directory in /var/www/proj/lib/Cake/Core/App.php on line 547

在线服务器的路径在/home3/username,但我的本地主机中有/var/www

我没有看到在我的本地(执行 ctrl+shift+f)中提到了 home3username

我使用的是 Cakephp v2.5.3

----- 更新 -----

除了路径,我看到 Cakephp 2 不能与 php7 一起工作,所以安装 php5 可以让项目正常工作。 https://askubuntu.com/questions/756879/cant-install-php5-on-ubuntu-16-04

【问题讨论】:

  • 尝试在core.php中移除缓存或设置debug>0
  • @Bart 我已将其设置为 2,但仍然没有。
  • @Bart & 我删除了缓存。
  • 所以检查你的 app/webroot/index.php 中的 CAKE_CORE_INCLUDE_PATH 常量
  • 谢谢@Bart。它正在运行。

标签: cakephp ubuntu-14.04 cakephp-2.5


【解决方案1】:

进入app/webroot并打开index.php文件,找到定义函数CAKE_CORE_INCLUDE_PATH,并将值更改为你的路径。

/**
 * The absolute path to the "cake" directory, WITHOUT a trailing DS.
 *
 * Un-comment this line to specify a fixed path to CakePHP.
 * This should point at the directory containing `Cake`.
 *
 * For ease of development CakePHP uses PHP's include_path. If you
 * cannot modify your include_path set this value.
 *
 * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
 *
 * The following line differs from its sibling
 * /app/webroot/index.php
 */
define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS . 'xampp' . DS . 'htdocs' . DS . 'cakephp' . DS . 'lib');

【讨论】:

    【解决方案2】:

    如果您已经从在线服务器下载了项目并在本地主机上运行它,请清除 app/tmp/ 中的文件。之后它会正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-15
      • 1970-01-01
      • 1970-01-01
      • 2011-09-05
      • 1970-01-01
      • 2014-03-09
      • 1970-01-01
      相关资源
      最近更新 更多