سؤال

I have a CakePHP app running on a shared host who recently upgraded me to PHP 5.4.x. For the most part, everything went smoothly, but now my shells won't run:

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.

Digging into cake/console/cake.php, it appears that the failure is occurring in this 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();
}

Specifically, the $this->args array is empty so there is no 0 index. This app is running CakePHP 1.3.17. I've checked another app running 1.3.16 and both the cake script and cake.php files are exactly the same. On the 1.3.16 site, though, the $this->args[0] value is set properly to the path of the script being called.

Any idea why my newly upgraded site wouldn't be getting that same value sent? This is an app that hasn't been touched in months. The only change has been the PHP upgrade as far as I know and can tell.

Any insight would be much appreciated.

هل كانت مفيدة؟

المحلول

Somewhere in the process of upgrading the PHP version, my host decided to play games with my php.ini file and register_argc_argv value got turned off. Turning it back on was exactly what I needed.

See also: https://stackoverflow.com/a/3570142/1665

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top