M
M
Mikhail Maslov2019-11-12 10:30:15
Yii
Mikhail Maslov, 2019-11-12 10:30:15

Yii debug panel not connecting, how to fix the error?

I connect debug through composer, in the config I write

<?php
    return [
      'id' => 'school',
      'basePath' => realpath( __DIR__ . '/../'),
      'bootstrap' => [
          'debug'
      ],
      'components' => [
          'urlManager' => [
              'enablePrettyUrl' => true,
              'showScriptName' => false
          ],

          'request' => [
              'cookieValidationKey' => 'super secret code'
          ]
      ],
        'modules' => [
            'debug' => [
                'class' => 'yii\debug\Module',
                  'allowedIPs' => ['*']
            ]
        ]
    ];
?>

The debugger panel is not shown.
Error in browser console:
GET localhost/debug/default/toolbar?tag=5dca5b2e5ec7c 404 (Not Found)
ajax @ (index):37
(anonymous) @ (index):66
(anonymous) @ (index):426
OpenServer Home comp. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim, 2019-11-15
@exileman

Your problem is most likely with urlManager or htaccess if you are using Apache. The error is 404. This means that such a page does not exist. Set these two items as required. If there are other errors - write.

D
D1mQ4, 2020-07-09
@D1mQ4

It is hardly relevant, but for those who get to this page with the same problem.
Try adding a require __DIR__ line to web/index.php . '/../vendor/autoload.php';
I searched the Internet all day - I didn’t find it, as a result I compared the configs on the framework with the pre-installed debugger and my own and found such a difference.
My config

<?php 
//Включает дебагер YII
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require __DIR__ . '/../vendor/autoload.php';
require __DIR__.'/../vendor/yiisoft/yii2/Yii.php';
$config = require __DIR__.'/../config/web.php';
(new yii\web\Application($config))->run();

?>

Local site OpenServer

U
uncletobe, 2019-11-12
@uncletobe

Connect to main-local

$config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        'allowedIPs' => ['127.0.0.1', '::1'],
    ];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question