Error 404 - Unable to resolve the request "gii"

It’s over a week I’m trying to create a project in Yii Framework on my localhost. I’ve tried with WampServer/XAMP/Zend Server/Apache/… but I always have same problem with gii.

It’s what I’ve done :

  1. a localhost server (like XAMP) installed

  2. Yii Framework zip file extracted to htdoc folder

  3. yii webapp test1 -> in command line

  4. http://127.0.0.1/yii/framework/test1/index.php -> it is ok and it shows my welcome screen with no problem

  5. http://127.0.0.1/yii/framework/test1/index.php?r=gii -> Always Problem ->

output:

Error 404

Unable to resolve the request "gii".

  1. I have edited my main.php and test the codes :

                'gii'=>array(
    
    
     	'class'=>'system.gii.GiiModule',
    
    
     	'password'=>'123456',
    
    
               'ipFilters'=>array('127.0.0.1'),
    
    
     ),
    

but nothing changed and I have the problem so. Please solve this problem coz I think it is a problem for a lot of Yii beginners like me.

Thx

If http://127.0.0.1/yii/framework/test1/index.php works

then http://127.0.0.1/yii/framework/test1/index.php?r=gii should work too.

Anyway if you can’t make it work, you can always use command line to create Controllers/Crud/Models/…


cd yii/framework/test1/

../yiic shell

help

ps. you should not create you application inside yii or inside yii/framework

you should not create you application inside yii or inside yii/framework

You meant that I should make a Virtual Directory outside framework folder?

by the way thank u very much for ur fast reply

one prefered way to organize you projects would be




/projects

    /project_1

        /protected

        /index.php

        /index-test.php

        /info.php

        ...

    /project_2

        /protected

        /index.php

        /index-test.php

        /info.php

        ...

    /yii

        /framework

        /requirements

        ...



and your apache server then should point to either /projects/project_1, or /projects/project_2

but to understand better the ways of yii, i recomend you to read "Agile Web Application Development with Yii 1.1 and PHP5"

(sorry if is not apropriate to say the name of the book here…)

Yes it is done and I have created my project in an external folder . again I have no problem with index.php but index.php?r=gii shows the same 404 problem.

I followed this instruction but it is not solved.

I just followed the Yii instruction in http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app

It’s done step by step but the problem never solved.

I can not open that gii ahhhhhhhhh.

You are aware that "gii" should be inside of "modules" area in config, right ?

i mean:




[...]

'modules'=>array(

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'password',

		),

	),

[...]



also remove the ipFilters, you don’t need it.

it is my main.php content

<?php

// uncomment the following to define a path alias

// Yii::setPathOfAlias(‘local’,‘path/to/local-folder’);

// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

'basePath'=&gt;dirname(__FILE__).DIRECTORY_SEPARATOR.'..',


'name'=&gt;'My Web Application',





// preloading 'log' component


'preload'=&gt;array('log'),





// autoloading model and component classes


'import'=&gt;array(


	'application.models.*',


	'application.components.*',


),

[color=“red”] ‘modules’=>array(

	// uncomment the following to enable the Gii tool


	/*


                  'gii'=&gt;array(


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


                  'password'=&gt;'123456',


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


),


	*/


),[/color]





// application components


'components'=&gt;array(


	'user'=&gt;array(


		// enable cookie-based authentication


		'allowAutoLogin'=&gt;true,


	),


	// uncomment the following to enable URLs in path-format


	/*


	'urlManager'=&gt;array(


		'urlFormat'=&gt;'path',


		'rules'=&gt;array(


			'&lt;controller:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/view',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


		),


	),


	*/


	'db'=&gt;array(


		'connectionString' =&gt; 'sqlite:'.dirname(__FILE__).'/&#46;&#46;/data/testdrive.db',


	),


	// uncomment the following to use a MySQL database


	/*


	'db'=&gt;array(


		'connectionString' =&gt; 'mysql:host=localhost;dbname=testdrive',


		'emulatePrepare' =&gt; true,


		'username' =&gt; 'root',


		'password' =&gt; '',


		'charset' =&gt; 'utf8',


	),


	*/


	'errorHandler'=&gt;array(


		// use 'site/error' action to display errors


        'errorAction'=&gt;'site/error',


    ),


	'log'=&gt;array(


		'class'=&gt;'CLogRouter',


		'routes'=&gt;array(


			array(


				'class'=&gt;'CFileLogRoute',


				'levels'=&gt;'error, warning',


			),


			// uncomment the following to show log messages on web pages


			/*


			array(


				'class'=&gt;'CWebLogRoute',


			),


			*/


		),


	),


),





// application-level parameters that can be accessed


// using Yii::app()-&gt;params['paramName']


'params'=&gt;array(


	// this is used in contact page


	'adminEmail'=&gt;'webmaster@example.com',


),

);

can u see that your gii module is commented out ?

How do u expect to work ????

Remove the /* and */ before and after gii and it will work

I removed it and it is like

‘modules’=>array(

	// uncomment the following to enable the Gii tool


	/*


                  'gii'=&gt;array(


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


                  'password'=&gt;'123456',


),

But nothing changed.

look I just created a project with “yiic webapp test1” it doesn’t worked I edited main.php and changed ipFilters but didn’t solve. I think the problem is somewhere else.

See my above comment about your mistake, uncomment the module in order to work.

Ohhhhhhhhhh Solved. that is great . I was blind really coz I was confused with the Yii structure and I didn’t see that /* */ really thx , it is a proverb says “Always 2 eyes see better that 1”

I suggest they correct it in Yii tutorial and remark that yiic compiler insrets /* */ by default and you should remove them. I didn’ see this anywhere in structures!

Thx again

It is solved please close this topic here.

Why would you want to close the topic…

There is no need to close or mark a topic as solved… becasue anybody can have the same problem in the future and continue this discussion…

I solved mine by [size="5"][font="Arial Black"]rechecking the .htaccess file … [/font][/size]

here is my .htaccess




# index file can be index.php, home.php, default.php etc.

DirectoryIndex index.php


# Rewrite engine

RewriteEngine On


# condition with escaping special chars

RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]