Unable to resolve the request "gii".

Hi,

I am looking to implement yii i am getting the error while trying to access gii

Unable to resolve the request "gii".

My code is:


<?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'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'Tri Kore',


	// preloading 'log' component

	'preload'=>array('log'),


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

	),


	'modules'=>array(


		'gii'=>array(

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

			'password'=>'trikore',

		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.

			'ipFilters'=>array('127.0.0.1','192.168.1.105'),

		),

		

	),


	// application components

	'components'=>array(

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

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

		/*

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),

		*//*

		'db'=>array(

			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

		),*/


		// uncomment the following to use a MySQL database

		

		'db'=>array(

			'connectionString' => 'mysql:host=localhost;dbname=testdrive',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '',

			'charset' => 'utf8',

		),

				'errorHandler'=>array(

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

            'errorAction'=>'site/error',

        ),

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

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

				/*

				array(

					'class'=>'CWebLogRoute',

				),

				*/

			),

		),

	),


	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'support@trikore.com',

	),

);



Please help to resolve this issue.

Thanks in Advance

You have commented out urlManager.

Are you using .htaccess?

I would recommend:

A/ Set correctly your urlManager like this (disable .htaccess):




'urlManager'=>array(

	'urlFormat'=>'path',

	'rules'=>array(

		'<controller:\w+>/<id:\d+>'=>'<controller>/view',

		'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

		'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

	),

),



B/ Check site links work OK.

C/ Then access gii via …mysite.com/index.php?r=gii

Should work.

If not, generate new tesdrive app and try again steps above.

http://www.yiiframework.com/doc/guide/1.1/en/topics.gii

Lubos

Thanks, I generated new app it works fine…

[Working with yii since 2 days]… I had the same problem with the “blog” demo. I created a new project as mentioned above and it worked… because the ‘urlManager’ section is disabled per default on a new project. It looks like when this is configured as mentioned above yii expects urls in path fashion only. When I commented this section out the blog demo would also accept the …/index.php?r=gii URL… Any clues?

Hi,

I had this problem too. I troubleshot by creating a fresh test app using the Yiic tool in the command line and comparing the two protected/config/main.php files. I found I had accidentally rearranged the nested gii/modules array inside another one when it was supposed to be directly under the main returned array.

Also try replacing your main.php config file with a fresh one created by yiic. Gii should work then. Then spot the difference between that and your original main.php.

Hope this helps.