fosh4455
fosh4455

Reputation: 371

How do I enable debug mode in Yii2?

I have the base version. I read the article http://www.yiiframework.com/doc-2.0/yii-debug-module.html but I do not understand in which file to insert the code, which includes debugging?

I searched the information and found that in config/web.php Now I wrote in it debug in the section YII_ENV_DEV like this:

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        // uncomment the following to add your IP if you are not connecting from localhost.
        'allowedIPs' => ['85.89.139.124'],
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        // uncomment the following to add your IP if you are not connecting from localhost.
        //'allowedIPs' => ['127.0.0.1', '::1'],
    ];
}

app/web/index.php

 <?php
       defined('YII_DEBUG') or define('YII_DEBUG', true);
       defined('YII_ENV') or define('YII_ENV', 'dev');

But it does not work and I see just a 404 error.

Upvotes: 10

Views: 34283

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133410

check in your app/web/index.php and be sure you have

 <?php
       defined('YII_DEBUG') or define('YII_DEBUG', true);
       defined('YII_ENV') or define('YII_ENV', 'dev');
         ........

Upvotes: 13

Related Questions