1

I'm struggling to get the Yii crud tool to work for me. I'm using Gii and this is the error I'm getting in my log file:

PHP Fatal error:  Cannot redeclare class CController in /var/www/includes/framework/web/CController.php on line 77

These are the only steps I have taken:

1) Downloaded yii and extracted 'framework' into /var/www/includes

1.5) Created a table called me in my database [EDIT]

2) Executed /var/www/framework/yiic webapp /var/www/web

3) uncommented 'gii'=>array(....) in config/main.php

3.5) Added my database configurations [EDIT]

4) Browsed to http:///index.php?r=gii

5) Navigated through Model generator to create 'me'

6) Navigated through Crud generator using me

7) Browsed to http:///index.php?r=me

Any ideas? I've spent ages on this and now I'm rather annoyed. :(

Thanks for your help in advance.

Mr Goobri
  • 1,449
  • 5
  • 19
  • 42

2 Answers2

0

It looks like you have the framework in /var/www/framework/ AND /var/www/includes/framework/. Thus it is being included twice and you get an error that you are declaring the class twice. Remove the second copy from the /includes folder and stick with the one in /www. It's also best practice to make sure your framework folder is not accessible from the web.

ShaunUK
  • 929
  • 6
  • 17
  • Thanks Shaun. I like your suggestion regarding the location of framework - thanks. I will double check whether I have it twice later on. – Mr Goobri May 07 '13 at 14:40
0

I'm not sure why this worked but it did.

I simply renamed the framework directory to yii and it worked. I did nothing else.

This has confused me but at least it now works.

Mr Goobri
  • 1,449
  • 5
  • 19
  • 42