Having almost the same problem here, but with Portlets. I’m using
Yii::import('zii.widgets.CPortlet');
and sometimes it gives me an error "failed to open stream: No such file or directory" (CPortlet.php). I can solve this by editing my widget/portlet file (add a space and save the file), but after editing some other files the error mentioned above appears again.
Is there any update on this? I’m still randomly getting error 500:
"include(CPortlet.php) [function.include]: failed to open stream: No such file or directory"
I didn’t make any changes to the code for a while and everything was fine untill today I got emails from my users telling me about this error. I just resaved the file (the component which imports CPortlet) and everything works fine.
Here is my component:
<?php
Yii::import('zii.widgets.CPortlet');
class Reviewed extends CPortlet {
public $title='<h3>Title</h3>';
public function getid() {
return $this->id = 'widget-reviewed';
}
public $htmlOptions=array('class'=>'sidebar-widget');
public $titleCssClass='widget-title';
public $contentCssClass='widget-content';
public $decorationCssClass='widget-title-wrapper';
public function getReviewed() {
$criteria = new CDbCriteria;
...
return MyModel::model()->findAll($criteria);
}
protected function renderContent() {
$this->render('reviewed');
}
}
Do you use an opcode cache (APC)? If so, which version is it and can you try with cache disabled? I mean not in Yii configuration but fully disable in php.ini.
Yes, I do. The version of APC I use is 3.0.19. I can try to disable cache, but I don’t know when the error will show up the next time (maybe a week or a month). Anyway I’d like to get this working with APC enabled if possible =)
I remember similar issues with APC in PRADO (the Yii predecessor). We couldn’t really find a solution but the problem seemed to disappear with APC 3.1.2.