Home > php, webframework, yii > Fix gii 403 Error in yii

Fix gii 403 Error in yii

This labor day weekend I’ve been learning yii – a php framework by reading the recently published Agile Web Application Development with Yii1.1 and PHP5. While trying to get the gii code generator working I got stuck somehow by a 403 error. Googling around and all solutions talk about adding the following bold line

return array(
    ......
    'modules'=>array(
        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'your-password',
            'ipFilters'=>array(...a list of IPs...), // ***
        ),
    ),
);

to the main configuration file. A bit configuration info about my server set: server is a headless sheevaplug with Ubuntu 9.04 with php 5.2, yii 1.1.4 (just released this weekend). Server ip is 192.168.3.40 and the web client’s ip (where I am trying to access gii) is 192.168.3.100. I added 192.168.3.100 to the ipFilters array but still didn’t work. A bit more googling points me to http://www.yiiframework.com/forum/index.php?/topic/10269-gii-403-forbidden/ and I added
echo $_SERVER[‘REMOTE_ADDR’];
to top of the main index.php file and I saw this line:

::ffff:192.168.3.100

This explains why adding 192.168.3.100 didn’t work, it seems my sheevaplug recognizes the remote client’s ip in ipv6 format and after adding the above string to ipFilters array the problem was solved.

Advertisements
Categories: php, webframework, yii
  1. Jersey
    September 11, 2010 at 2:35 am

    Thank you! Had that issue and this fixed it right away.

  2. pba
    October 25, 2010 at 2:08 pm

    Thanks!
    In my case it was ipv4 address but it didn’t work as well. Now it does :)
    Cheers!

  3. November 17, 2010 at 10:05 am

    That hint just came handy. Was already tended to take the framework apart for looking at that :)

  4. camden-kid
    April 13, 2012 at 4:05 pm

    Thanks!

  1. September 11, 2010 at 6:32 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: