testdrive application not working - 'Cannot redeclare class Controller...'

Hi everyone.

My system configuration is:

  • Win XP Professional SP3

  • MySQL 5.2 + PHP 5.3.5 + Apache 2.2 (regular XAMPP stack)

  • Yii 1.1.8

I am trying to build my first Yii app like described in the site quickstart.

I have defined %YiiRoot% and %WebRoot% system variables: the first points to yii framework (%phproot%/ext/frameworks/yii/1.1.8, where I copied the yii framework folder), the latter points to my apache doc root.

I have successfully created project structure (named test-yii instead of testdrive) in my web root, via

the command line instruction:

%YiiRoot%/framework/yiic.bat webapp %WebRoot%/test-yii, like in the tutorial (except for the project name).

My config/main.php contains:

(…)

// autoloading model and component classes


'import'=>array(


            'application.components.*',


	'application.models.*'


),


'modules'=>array(


	// uncomment the following to enable the Gii tool


	'gii'=>array(


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


		'password'=>'gii',


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


		'ipFilters'=>array('127.0.0.1','::1')


	)


),

(…)

So clearly I import the right initial components and the gii module for code generation etc.

But when I try to launch http__localhost_test-yii in my browser, I get:

"Fatal error: Cannot redeclare class Controller in E:\www\test-yii\protected\components\Controller.php on line 7"

It’s seems there’s some include instead of include_once somewhere in the framework… But I haven’t modified the original source generated from yiic.

Please give me some hint, I am becoming desperate.

Thanks.

Can you show the content of the component folder and the contents of the index.php, config/main.php and components/Controller.php files?

I think that you have not a file .htaccess in your’s project root folder.

add this lines in this file:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpeg|jpg|js|css)$

if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

otherwise forward it to index.php

RewriteRule . index.php

also it seems like you have downloaded yii118 and have lefted a demos folder from yii117. And after that you a creating a new application and getting this error