升级到 PHP 5.4 后 CakePHP 控制台问题

标签 cakephp cakephp-1.3

我有一个在共享主机上运行的 CakePHP 应用程序,该主机最近将我升级到了 PHP 5.4.x。在大多数情况下,一切都很顺利,但现在我的 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,似乎故障发生在这个 block 中:

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 升级。

任何见解将不胜感激。

最佳答案

在升级 PHP 版本的过程中,我的主机决定使用我的 php.ini 文件玩游戏,并且 register_argc_argv 值被关闭。重新打开它正是我所需要的。

另请参阅:https://stackoverflow.com/a/3570142/1665

关于升级到 PHP 5.4 后 CakePHP 控制台问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20588533/

相关文章:

CakePHP 3 无法保存关联模型

php - CakePHP:如何路由分页的排序参数?

php - 在 Mac OSX 上使用 MAMP 时如何让 CakePHP bake 找到 mysql.sock 并识别 MySQL?

unit-testing - 将 PHPUnit 与 CakePHP 1.3 集成

mysql - 如何根据条件关联的模型字段对查询结果进行排序?

php - Cake 1.3 中是否有任何好的/简单的 Ajax 示例而不使用已弃用的助手?

php - 如何在 Cakephp 3 中创建按字段集分组的多个复选框

CakePHP Auth only for Admin Prefix

php - 无法在 CakePHP 的内部连接中获取第二个表值

cakephp - 使用 cakePHP,我可以在不先读取列值的情况下增加列的值吗?