I've created an application and changed my index.php like this (yii's parent dir is in my include_path):
$yii='yii-1.0.1/yiilite.php';
$config=dirname(__FILE__).'/protected/config/main.php';
// remove the following line when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once($yii);
Yii::createWebApplication($config)->run();
When i try to call yiic shell i get this error:
Quote
Fatal error: Cannot redeclare class Yii in /usr/share/php/yii-1.0.1/yiilite.php on line 364
I disabled APC for the commandline now (and even restarted Apache just to make sure…). But still the same error. yiic gives me the help message, yiic shell produces the error.
If i get it right, yiic first includes yii.php and then the applications index.php in the "shell" command. In index.php there's a require_once(). So no problem if i also use yii.php in index.php: it will get included only once. Not so for yiilite.php.
O.k. that means, we should always use yii.php in index.php when using yiic shell? Is there a reason why you include index.php instead of using the config file?
I know, this has been fixed. But there's still something strange happening here. I've an application created with yii-1.0.1.
When i now switch to latest yii.php in index.php, i again get:
Quote
Fatal error: Cannot redeclare class Yii in /usr/share/php/yii-svn/yii.php on line 29
It works, when using yii.php from 1.0.1 in index.php.
I've changed the accessRules for my default controller, to not allow anything for guest users (it's a private site, with access only for logged in users):
<?php
public function accessRules()
{
return array(
// Deny guests from everything
array('deny', 'users'=>array('?'))
);
}
Now whenever i want to start yiic shell, nothing happens (script exits without message, i'm back at the command prompt).
You where right with 1: Indeed it was a problem with yiic from the wrong version. I have a symlink to yiic (1.0.1) to /usr/bin. When using the original yiic from svn it works again.