M
M
Maila2017-10-12 15:16:56
Yii
Maila, 2017-10-12 15:16:56

Why doesn't the debag panel turn on?

Initially, the project did not have debug and gii versions and the panel was not displayed, I specified "~ 2.0.0" and the composer was updated, although with errors:
59df5b33b7d21859968625.jpeg
main-local (backend)

<?php
return [
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'RlQalJ6jcjOhtJZU0pBjNRT0-lo1YzIg',
        ],
    ],
];

if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];
}

return $config;

config/main.php
<?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-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [
    'debug' => [
        'class' => 'yii\debug\Module',
        'allowedIPs' => ['*']
    ],
],

    'defaultRoute' => 'order/index',
    'components' => [
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
    ],
    'params' => $params,
];

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Maxim Fedorov, 2017-10-12
@Maksclub

Specify available IPs, or for all

$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        'allowedIPs' => ['*'],
    ];

or your own
for gii also absolutely

A
Abdula Magomedov, 2017-10-12
@Avarskiy

What gives out if you go to the address?

/?r=debug

D
Dmitry, 2017-10-12
@slo_nik

Good evening.
If the site is on a local server, then remove it 'allowedIPs' => ['*'], and if on a hosting, then instead of "*" indicate the real ip address from which you access the site. You can find out the ip at https://2ip.ru/
Also clean the runtime/debug directory, set the rights to all directories in runtime www-data.
To do this, run the command in the console
sudo chown www-data:www-data folder_name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question