Yii 1.1 配置redis报错 [ 1.1 版本 ]
在服务器上配置redis,在服务器上是成功的,
当在项目config/main.php下是操作网上找的文档(http://blog.csdn.net/dc_726/article/details/8865340 )配置的
components=>array(
.......
'cache'=>array(
'class'=>'ext.redis.CRedisCache', //对应protected/extensions/redis/CredisCache.php
'servers'=>array(
array(
'host'=>'***.***.***.***',
'port'=>6379,
),
),
),
'session'=>array(
'class' =>'ext.PRedisCacheHttpSession.PRedisCacheHttpSession',
'database' => 9,
),
)
当我访问我自定义的设置缓存的方法
public function actionFetch()
{
$key = 'key1';
$value = 'key1value';
Yii::app()->cache->set($key, $value);
$data = Yii::app()->cache->get($key);
var_dump($data);exit;
}
是可以成功的
string(9) "key1value"
但是当我访问其他页面的时候就会报:
CException
Please ensure that CRedisCache is installed and instantiatable.
/alidata/www/yii1/dev/protected/views/layouts/main.php(35)
23 <div class="container" id="page">
24
25 <div id="header">
26 <div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div>
27 </div><!-- header -->
28
29 <div id="mainmenu">
30 <?php $this->widget('zii.widgets.CMenu',array(
31 'items'=>array(
32 array('label'=>'Home', 'url'=>array('/site/index')),
33 array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
34 array('label'=>'Contact', 'url'=>array('/site/contact')),
35 array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
36 array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
37 ),
38 )); ?>
39 </div><!-- mainmenu -->
40 <?php if(isset($this->breadcrumbs)):?>
41 <?php $this->widget('zii.widgets.CBreadcrumbs', array(
42 'links'=>$this->breadcrumbs,
43 )); ?><!-- breadcrumbs -->
44 <?php endif?>
45
46 <?php echo $content; ?>
47
Stack Trace
#0
+ /alidata/www/yii1/framework/base/CModule.php(394): PRedisCacheHttpSession->init()
#1
+ /alidata/www/yii1/framework/web/CWebApplication.php(201): CModule->getComponent("session")
#2
+ /alidata/www/yii1/framework/web/auth/CWebUser.php(199): CWebApplication->getSession()
#3
+ /alidata/www/yii1/framework/base/CModule.php(394): CWebUser->init()
#4
+ /alidata/www/yii1/framework/base/CModule.php(103): CModule->getComponent("user")
#5
– /alidata/www/yii1/dev/protected/views/layouts/main.php(35): CModule->__get("user")
30 <?php $this->widget('zii.widgets.CMenu',array(
31 'items'=>array(
32 array('label'=>'Home', 'url'=>array('/site/index')),
33 array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
34 array('label'=>'Contact', 'url'=>array('/site/contact')),
35 array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
36 array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
37 ),
38 )); ?>
39 </div><!-- mainmenu -->
40 <?php if(isset($this->breadcrumbs)):?>
………………………………
这个错误,不知道是什么原因
腐ru 北京
注册时间:2014-09-19
最后登录:2019-02-15
在线时长:7小时4分
最后登录:2019-02-15
在线时长:7小时4分
- 粉丝8
- 金钱85
- 威望10
- 积分255