White Page And Networkerror: 500 Internal Server Error But Not Everytime

Hello All,

after login to my page www.skym.sk I get an error NetworkError: 500 Internal Server Error. Interesting is that this error is not show everytime and also when I tried

defined('YII_DEBUG') or define('YII_DEBUG',true);

there is no error.

Can it be problem with memory limits?

Thank you… I am in production mode so thanks for every fast comment.

The 500 error is a bit cryptic as there are different things that could lead to it… your best bet would be to check the webserver log to get more info about the reason for it.

Right now it is on shared hosting so it can be problem with log from webserver…

try to see if you have any error log… if not contact your support they should be able to help you to identify the reason for this error.

Out of interest, try putting this at the top of your main index.php file:


I’m wondering if your test machine and live server have different levels of error reporting that could be causing the problem.

Only put that line in temporarily to see if that is the problem.

not happend when I put there error_reporting(0)… still just white screen… After I delete one(doesn’t matter which) div with component from view it working again…

My webhosting provider increase my memory limit and also post limit… Where can be problem?

Are you developing and deploying on different operating systems?

I am using findAll($criteria) in model… and right now I have more that 3000 users… so maybe I should change it…

in controller

$lastmodelsearch= new SearchForm;

$lastmodelsearch->attributes=  $lastsearch->criteria;

$searchResult = $lastmodelsearch->search();

$dataProvider = new CArrayDataProvider($searchResult,array('keyField'=>'user_id','pagination'=>array(



$this->render('index', array('dataprovider'=>$dataProvider));


I put there $criteria->limit=500; and it works… Yii has limitations? How it should be right?


this is interesting…

While I am rewriting I remember why I use CArrayDataProvider except of CActiveDataProvider.

I use group by in my CDbCriteria and then there is problem with paginations - CActiveDataProvider get all records in pager…

So what I did?

$criteria = new CDbCriteria();

        $criteria->select="encountering_id, encountered_id, count(encountering_id) AS number, max(t.added_on) AS last_added_on, (CASE WHEN is_seen=0 THEN 0 ELSE 1 END) as seen";

        $criteria->condition = 'encountered_id = :encounteredId';

        $criteria->addCondition('t.vote = :voteYes');


        $criteria->order = 'last_added_on DESC, number DESC';

        $criteria->params = array('encounteredId' => Yii::app()->user->id, 'voteYes'=>  self::VOTE_YES);

        $dataprovider=new CActiveDataProvider('Encounter', array('criteria' => $criteria,'pagination'=>array(





        $criteriaCount = new CDbCriteria();

        $criteriaCount->select="count(DISTINCT t.encountering_id)";


        $criteriaCount->condition = 't.encountered_id = :encounteredId';

        $criteriaCount->addCondition('t.vote = :voteYes');

        $criteriaCount->params = array('encounteredId' => Yii::app()->user->id, 'voteYes'=>  self::VOTE_YES);


        return $dataprovider;

maybe this will help somebody.

Some comments to code:

//$criteriaCount->distinct=true; this is commented because when I use



SQL is:

SELECT COUNT(DISTINCT `t`.id) FROM `encounter` `t` WHERE (t.encountered_id = :encounteredId) AND (t.vote = :voteYes) 


$criteriaCount->select="(DISTINCT t.encountering_id)";

//$criteriaCount->distinct=true; COMMENTED

SQL is:

SELECT COUNT(*) FROM `encounter` `t` WHERE (t.encountered_id = :encounteredId) AND (t.vote = :voteYes) 

and without any clever reason what I want is

$criteriaCount->select="count(DISTINCT t.encountering_id)";

//$criteriaCount->distinct=true; COMMENTED

SQL is:

SELECT count(DISTINCT t.encountering_id) FROM `encounter` `t` WHERE (t.encountered_id = :encounteredId) AND (t.vote = :voteYes) 


I forgot write why I use resetScope()

answer is here http://www.yiiframework.com/forum/index.php/topic/9168-override-defaultscope/