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'=>array(
'application.models.*',
'application.components.*',
),
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=> 'mylocal',
'ipFilters'=> array('localhost', '127.0.0.1'),
'newFileMode'=>0777,
'newDirMode'=>0777,
),
),
// application components
?></pre></code>
Setting the password to false does not work. Any suggestions?
mbs402
(Ms)
July 8, 2010, 1:35am
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
mikl
(Mike)
July 8, 2010, 6:30am
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'];
beastl
(It)
August 3, 2010, 9:37pm
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:
Go to:
framework/gii/GiiModule.php
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;
}
Set "echo $ip;" at the start of method.
Try to load gii main page, it’ll show you your ip address.
After that remove or comment this codeline.
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.