Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable debug mode in Yii2?

Tags:

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.

like image 228
fosh4455 Avatar asked Jul 13 '17 17:07

fosh4455


People also ask

How do I debug in Yii?

Usage. Once the extension is installed, simply modify your application configuration as follows: return [ 'bootstrap' => ['debug'], 'modules' => [ 'debug' => [ 'class' => 'yii\debug\Module', // uncomment and adjust the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.


1 Answers

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');
         ........
like image 123
ScaisEdge Avatar answered Oct 21 '22 03:10

ScaisEdge