This must be a silly mistake. but i can’t find it.
My cron job goes like this: (Yii 2.0.47 with php 8.1.18)
php -c /home/iscaljorge/devsaftXplore_in/console/controllers/php.ini /home/iscaljorge/devsaftXplore_in/yii Loadxml
My console controller is:
namespace console\controllers;
use yii\console\Controller;
class LoadxmlController extends Controller
{
public function actionIndex()
{
//something
}
}
My class file is LoadxmlController under console/controllers.
My job allways return this error:
X-Powered-By: PHP/8.1.18
Content-type: text/html; charset=UTF-8
<br />
<b>Fatal error</b>: Uncaught yii\base\UnknownPropertyException: Setting unknown property: yii\console\ErrorHandler::errorAction in /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('errorAction', 'site/error')
#1 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(yii\console\ErrorHandler), Array)
#2 [internal function]: yii\base\BaseObject->__construct(Array)
#3 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array)
#4 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('yii\\console\\Err...', Array, Array)
#5 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('yii\\console\\Err...', Array, Array)
#6 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#7 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/base/Module.php(766): yii\di\ServiceLocator->get('errorHandler', true)
#8 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/console/Application.php(210): yii\base\Module->get('errorHandler')
#9 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/base/Application.php(345): yii\console\Application->getErrorHandler()
#10 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/base/Application.php(202): yii\base\Application->registerErrorHandler(Array)
#11 /home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#12 /home/iscaljorge/devsaftXplore_in/yii(23): yii\console\Application->__construct(Array)
#13 {main}
thrown in <b>/home/iscaljorge/devsaftXplore_in/vendor/yiisoft/yii2/base/Component.php</b> on line <b>209</b><br />
My main.php console config file is:
<?php
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
);
return [
'id' => 'app-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'console\controllers',
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'controllerMap' => [
'fixture' => [
'class' => \yii\console\controllers\FixtureController::class,
'namespace' => 'common\fixtures',
],
],
'components' => [
'log' => [
'targets' => [
[
'class' => \yii\log\FileTarget::class,
'levels' => ['error', 'warning'],
],
],
],
],
'params' => $params,
];
I just can’t figure out why my console app does not start. Any help would be appreciated. Thank you.