Yii2 debug bar not showing on staging server even with allowedIP's entry

AllowedIPs parameter should contain your ip, check $_SERVER['REMOTE_ADDR'] for it and set it into AllowedIPs. See how gii check access


i know this is old but it may help someone now since this isn't very clear anywhere on the web.

We used to have this problem a lot when deploying to test and dev servers. Add this to your main-local.php

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

DO NOT DO THIS ON A PRODUCTION SERVER!!!!


Check what you have in your frontend/web/index.php or app/web/index.php

you need

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

Tags:

Php

Yii

Yii2