Archive

Archive for the ‘webframework’ Category

Fix gii 403 Error in yii

September 6, 2010 5 comments

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