Brett Brett -4 years ago 213
PHP Question

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

I'm trying to get the debug bar in

to show on my staging server but for some reason it isn't showing.

Here is code from my
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download