Config Gii

Hi,

I am newbie in Yii2 and I downloaded the basic template and i configured the database. I realized that GII is configured in web.php


if (YII_ENV_DEV) { 

     $config['preload'][] = 'debug'; 

     $config['modules']['debug'] = 'yii\debug\Module'; 

     $config['modules']['gii'] = 'yii\gii\Module'; 

}

But when i tried to access in index.php?r=gii i get the error 403 Forbidden.

I checked the index.php and YII_ENV_DEV is defined like dev


defined('YII_ENV') or define('YII_ENV', 'dev');

Somebody know what i missing?

Thanks!

i comment out the line $config[‘modules’][‘gii’] = ‘yii\gii\Module’;

and add new following line into the web.php

[indent] ‘modules’ => [

            'gii'=> [


                'class' => 'yii\gii\Module',


                'allowedIPs' => ['192.168.1.2'],


    ],[/indent]

I’ve adjusted the guide to reflect this difference: https://github.com/yiisoft/yii2/commit/896268995d6c302f3ba86bd317256f28f3bb52a6

Thanks!!

My problems was the ‘allowedIPs’. I was added the following lines


'allowedIPs' => ['127.0.0.1', '::1', 'localhost']

And my app is hosted in a server so I have to add allowed IPs of my current computer.

I solved with:


'allowedIPs' => ['208.68.37.61']

Why do you want Gii on server btw.?

Because we are a team developing the app and we have the test version in a hosting. We have a git repository and upload the files by FTP to see the changes. Thus we use a single database and not have to maintain many databases updated.

It is our solution, maybe there is a better way.

Sure there is. Check how you can deploy via git and use DB migrations to keep DB structure in repository.

I wonder how to set the rule for gii when we use urlmanager?

Thanks

It should work as is.