【发布时间】:2013-12-14 21:36:49
【问题描述】:
我有一个在最近将我升级到 PHP 5.4.x 的共享主机上运行的 CakePHP 应用程序。在大多数情况下,一切都很顺利,但现在我的 shell 无法运行:
CakePHP Console: This file has been loaded incorrectly and cannot continue.Please make sure that /cake/console is in your system path,and check the manual for the correct usage of this command.
深入cake/console/cake.php,看来故障发生在这个区块:
if (!isset($this->args[0]) || !isset($this->params['working'])) {
# debug($this->args);
# debug(isset($this->args[0]));
$this->stderr("\nCakePHP Console: ");
$this->stderr('This file has been loaded incorrectly and cannot continue.');
$this->stderr('Please make sure that ' . DIRECTORY_SEPARATOR . 'cake' . DIRECTORY_SEPARATOR . 'console is in your system path,');
$this->stderr('and check the manual for the correct usage of this command.');
$this->stderr('(http://manual.cakephp.org/)');
$this->_stop();
}
具体来说,$this->args 数组是空的,所以没有 0 索引。这个应用程序运行的是 CakePHP 1.3.17。我检查了另一个运行 1.3.16 的应用程序,cake 脚本和cake.php 文件完全相同。但是,在 1.3.16 站点上,$this->args[0] 值被正确设置为被调用脚本的路径。
知道为什么我新升级的网站不会发送相同的值吗?这是一个几个月没有被触及的应用程序。据我所知,唯一的变化是 PHP 升级。
任何见解将不胜感激。
【问题讨论】:
-
我们在使用 Cake 1.3 时升级到 PHP 5.3 以上时遇到了问题 - 如果您有升级 PHP 超过该点,您可能还必须升级您的 Cake 核心(以及所有不推荐使用的函数,以及随后返回不同结构的非向后兼容查询函数)。
标签: cakephp cakephp-1.3