Sunday 4 August 2013

Fix Gii Error 403 You are not allowed to access this page (Yii Framework)

After configuring Yii framework or YiiBoilerPlate you might be getting following error while accessing Gii code generator:

Error 403
You are not allowed to access this page:

This can be happen in your localhost or remote host wherever you are developing your web app. To resolve this you need to add your development computer’s IP address to your main.php file as follows:

In Yii Framework

1) Go to yourwebapp/protected/config folder.
2) Open main.php file.
3) Add the following line in main.php in "gii" array as follows:

'gii' => array(
            'class' => 'system.gii.GiiModule',
            'password' => 'admin',
            'ipFilters' => array('127.0.0.1', $_SERVER['REMOTE_ADDR'])
),

YiiBoilerPlate

And if you are using YiiBoilerPlate then go to yourwebapp/backend (or frontend)/config/main.php file and add the same line in Gii array.

No comments:

Post a Comment