Gii 403 forbidden


(Carlmcdade) #1

I can’t seem to get past a 403 message when using Gii. Running the latest yii (as of this posting date) on a Mac and using Xampp - php5.2.4

<code><pre><?php

// autoloading model and component classes

'import'=&gt;array(


	'application.models.*',


	'application.components.*',


),


'modules'=&gt;array(


        'gii'=&gt;array(


            'class'=&gt;'system.gii.GiiModule',


            'password'=&gt; 'mylocal',


            'ipFilters'=&gt; array('localhost', '127.0.0.1'),


            'newFileMode'=&gt;0777,


            'newDirMode'=&gt;0777,


        ),


 ),





// application components

?></pre></code>

Setting the password to false does not work. Any suggestions?


(Ms) #2

Mine is working fine, take a look and see if it might help…

I’ve got it setup this way :

$aEnable = array( ) ;

<snip> … </snip>

$aEnable[‘gii’] = true ; // <— SET TO {true, false} [default = false] [MAKE CHANGES]

$aEnable[‘gii_modules’] = $aEnable[‘gii’] ; // [ OVER-RIDE IF REQUIRED]

$aEnable[‘gii_modules_generator_paths’] = $aEnable[‘gii’] ; // [ OVER-RIDE IF REQUIRED]

$aEnable[‘gii_components_url_manager_rules’] = $aEnable[‘gii’] ; // [ OVER-RIDE IF REQUIRED]

As you can see above, I set a flag with three components {‘gii_modules’, ‘gii_modules_generator_paths’, ‘gii_components_url_manager_rules’}

Take a peek at my yii website, it is not finished yet, but I’ve started putting quite a bit of stuff on it already.

http://www.journey-of-flight.com/home_brew/index.php

Select : --> Programming --> Yii Framework --> Easy Configuration

I’ve got mine disabled, but newFileMode should not have the executable flag set. Your 0777 should be 0666. I don’t think this is causing your problem though.

// $aArray[‘modules’][‘gii’] [‘newFileMode’] = 0666 ;

// $aArray[‘modules’][‘gii’] [‘newDirMode’] = 0777 ;

The 403 message is Apache’s way let you know to check the permissions.

Good Luck,

Bill Hernandez

Plano, Texas


(Mh) #3

Try to disable ipFilters for a test. If that works, you seem to have another client IP for your request. You can find out by adding this line on top of your index.php:


echo $_SERVER['REMOTE_ADDR'];


(It) #4

If previous post is not clear for you, read this.

Try to check your ip from which you connect to your site, for this do:

  1. Go to:

framework/gii/GiiModule.php

  1. Find this part:

protected function allowIp($ip)

{

	if(empty($this->ipFilters))

		return true;


	foreach($this->ipFilters as $filter)

	{

		if($filter==='*' || $filter===$ip || (($pos=strpos($filter,'*'))!==false && !strncmp($ip,$filter,$pos)))

			return true;

	}


	return false;

}

  1. Set "echo $ip;" at the start of method.

  2. Try to load gii main page, it’ll show you your ip address.

  3. After that remove or comment this codeline.

  4. Set ipFilters setting to your ip

‘ipFilters’=> array(‘localhost’, ‘127.0.0.1’, 10.11.1.1),

I don’t know yet why, but my gii showed me that my ip is 10.11.1.1 (my real local ip is 10.11.1.3) .

10.11.1.1 is my router ip address. May be in some time you’ll see more interesting ip.