Trying to get property ‘params’ of non-object in C:\xampp\htdocs\referandearn\frontend\config\main.php on line 52
how to solve this issue
Trying to get property ‘params’ of non-object in C:\xampp\htdocs\referandearn\frontend\config\main.php on line 52
how to solve this issue
Add relevant code as well
<?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-frontend',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'frontend\controllers',
'homeUrl' => Yii::getAlias('@frontendUrl'),
'name' => 'IIFL Securities',
'components' => [
'request' => [
'csrfParam' => '_csrf-frontend',
'baseUrl' => '/referandearn',
// 'hostInfo' => 'http://localhost',
'on beforeRequest' => function ($event) {
if (!Yii::$app->request->isSecureConnection) {
$url = Yii::$app->request->getAbsoluteUrl();
$url = str_replace('http:', 'https:', $url);
Yii::$app->getResponse()->redirect($url);
Yii::$app->end();
}
},
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => false,
'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true, 'secure' => true],
'authTimeout' => 300, //5min
],
'session' => [
// this is the name of the session cookie used for login on the frontend
'name' => 'advanced-frontend',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
[
'class' => 'yii\log\EmailTarget',
'mailer' => 'mailer',
'levels' => ['error', 'warning'],
'message' => [
'from' => [Yii::$app->params['supportEmail']],
'to' => ['marnab88@gmail.com'],
'subject' => 'Log message',
],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'urlManager' => [
'class' => 'yii\web\UrlManager',
// Disable index.php
'showScriptName' => false,
// Disable r= routes
'enablePrettyUrl' => true,
'rules' => array(
'referandearn/<token:\S+>' => 'site/index1',
'b2b/<token:\S+>' => 'site/b2b',
'premia/<token:\S+>' => 'site/premia',
'<controller:[\w\-]+>/<id:\d+>' => '<controller>/view',
'<controller:[\w\-]+>/<action:[\w\-]+>/<id:\d+>' => '<controller>/<action>',
'<controller:[\w\-]+>/<action:[\w\-]+>' => '<controller>/<action>',
'<action:(.*)>' => 'site/<action>',
),
],
'as hostControl' => [
'class' => 'yii\filters\HostControl',
'allowedHosts' => [
'localhost',
'134.122.124.149',
'35.190.2.88'
],
'fallbackHostInfo' => 'http://35.190.2.88/iifl',
],
],
'params' => $params,
];[Processing: main.php...]()
Frontend main.php file code i have added
Unreadable please format it using code block
formatted the code. The error is showing at
'message' => [
'from' => [Yii::$app->params['supportEmail']],
'to' => ['marnab88@gmail.com'],
'subject' => 'Log message',
],
Array refer to itself before it’s defined.
I think you can solve it with another array_merge().