Search code examples
phpmysqlsqlyiierror-log

White screen of death on php site for certain query?


Hi im experiencing white screen of death on my php site which only occurs given a certain query and i cant seem to find any errors . I tried looking at var/logs/apache2 and looked for php error log and there was none.

I am using yii. I have a page which list filtered contents. In my controller, i have like a query :

     $model= Person::model()->findbyPk('12345');
     $list = $model->contacts;

The 'contacts' is a relation of 'person' model, and the list is what i should display. If i query people with keys '12345', '14256, and '23489', The page will show properly. But when I query a particular '10012', it will give me a white screen with no errors and no style format. Just a blank screen. And it also loads really load longer than other queries. I tried logging it and check in the shared-data/runtime but it wont even reach the controller. It just happens for this certain Person.

What seems to be the most likely cause of this?


Solution

  • The main problem was there was too much data in Person model's relation contacts. The relation was one to many. Solution was getting contacts using another way/query.

    What i am still not sure about is why when i log inside the controller where i run the query, it would not even reach the controller. Even though the log was was before the query was run, e.g.

       function actionListContacts() {
            Yii::log('Ireached this function');
            $request = Yii::app()->request;
            $personId = $request->get('personId');
    
            $model = Person::model()->findByPk($personId);
            // This is where the query for contacts should start..
            $contacts = $person->contacts;
    
            $this->render(['contacts' => $contacts]);
       } 
    

    If i use id '12345', render is successful and if i check the logs, i can see my log. But when i use 10012, which caused the white page and i checked the logs, it didnt even reach the controller. And by the way, id '10012' is existing checked the database myself. :)