• 14

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I'm trying to get the debug bar in Yii2 to show on my staging server but for some reason it isn't showing.

Here is code from my web.php config file:

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

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\gii\Module';
} obviously is just an example for the server's real IP.

I get the servers IP by doing:

$host = gethostname();
$server_ip = gethostbyname($host);

If I try and access the debug page by going to:


I get the message: You are not allowed to access this page.

I am sure I had this working before but now it's not working for some reason and I can't figure out why!?

I'm aware there are debug data files (not sure if they will contain any info on why I can't see it) but I am not sure how I can view the data properly?

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',


  • 5
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions