White screen of death - no errors in PHP / Vagrant environment (Yii)

I can't be sure if this problem is partially vagrant related, however I have a Yii 1.x installation in a Vagrant box with Unix.

I'm trying to force a simple PHP error such as a missing semicolon in a controller, although I'm 100% sure I'm getting an error. I don't see the standard Yii error page with stack trace. This previously worked, although it would appear that something recently stopped working this way.

Strange: Yii displays database queries at the bottom of the script (this is intended, but I can't figure out why Yii only displays database queries.

My personal config looks like this: (only showing part of it).

I have tried the code below and checked the logs but no joy

ini_set('display_errors',true);
error_reporting(E_ALL);

      

Can anyone suggest some ideas ...

return array(
'yiiDebug'      => true,
'yiiTraceLevel' => 6,
.....


'components'=>array(
   'log' => array(
   'class'  => 'CLogRouter',
   'routes' => array(
   'web'  => array(
   'class'         => 'CWebLogRoute',
   'levels'        => 'profile, trace, info, error, warning, application', // profile, trace, info, error, warning, application
                    'showInFireBug' => false
                ),
   'file' => array(
   'class'      => 'CFileLogRoute',
   'levels'     => 'error, warning, watch', // error, warning, watch
   'categories' => 'system.*',
              ),
             array(
              'class'       => 'CProfileLogRoute',
              'levels'  => 'error, warning, trace, info, profile', // error, warning, trace, info, profile
              ),
            ),
        ),
    ),

      

So for example ... in one of my controllers, I have the following code:

public function actionDelete($id)
{
  $model = $this->loadModel($id);
  5e55 // added error here on purpose
}

      

I would expect an error on the 2nd line regarding 5e55, which has no room, but instead of getting the error, all I see is a white screen (plus the Yii app log that shows all requests, etc.) - if I remove the contents of the yii config for outputting requests, i get 100% white / blank screen.

I've tried adding various things to the bootstrap index.php file, but without any joy, my config looks relatively fine, but I can't figure out why the error message is being reported in the browser or in my logs.

+3


source to share


5 answers


You did the right thing by setting

ini_set('display_errors',true);
error_reporting(E_ALL);

      

... but there are several reasons why this might not actually take effect.

1) The error message can be disabled again by something "later" in the script. Since these parameters are mostly just global variables, anyone can set them and most frameworks are disabled somewhere. Depending on where your code was included, something else in the chain might have caused display_errors to be false.

2) Changing settings can be disabled at runtime. Your environment might have something like php_admin_flag directives to stop display_errors from being enabled.

If you can get output at all, try running this to reset the state of all ini settings:

var_dump(ini_get_all());

      



BUT what I think is probably going on . You have a small syntax error in one of your own files and the interpreter discards that code entirely. It never ran, so the display_errors setting doesn't even get triggered.

As others have suggested looking at your error logs will probably tell you what's going on.

Another hacky but useful way is to try to execute your files on the command line and see if it gives a syntax warning. I'm not familiar with Yii, but I found the files you recently edited and ran this:

php -f yourproject/somefile_ofyours.php

      

It will probably spit out an error like:

PHP Parse error:  syntax error, unexpected 'xxxxx' (T_STRING) in somefile_ofyours.php on line 27

      

+5


source


Do you have a php error log file set in php.ini? Does it contain anything? Have you tried to force yii debug mode via php?

  define( 'YII_DEBUG', true );

      



other head top ideas:

  • enable html error and warning output
  • see the phpinfo that you are using the correct php.ini and this error message does not indicate what you installed it to.
  • check apache error log
  • what is the meaning $_SERVER['APPLICATION_ENV']

    ?
+1


source


First of all ... you can check the rules that the current user is allowed to view the error page

public function accessRules()
        {
         return array(array('allow',
                               'actions' => array('index', 'view', 'error'),
                               'users' => array('@')),
        }

      

And also check.

public function actionError()
       {
       if($error=Yii::app()->errorHandler->error)
       {
        if(Yii::app()->request->isAjaxRequest)
            echo $error['message'];
        else
            $this->render('error', $error);
       }
       }

      

When an error is passed to the CErrorHandler application component, it selects the appropriate view to display the error. This link can help

protected function resolveErrorMessage($rule)
{
if($rule->message!==null)
return $rule->message;
elseif($this->message!==null)
return $this->message;
else
return Yii::t('yii','You are not authorized to perform this action.');
}

      

  • Allows to display an error message.
  • This method will check {@link message} and {@link CAccessRule :: message} to see
  • what error message should be displayed.
  • @param CAccessRule $ rule access rule
  • @ return the error message string

Source: Link

+1


source


Check your error log files and submit error messages here. This can help solve your problems.

Also make sure you have the settings below in PHP.ini

; Report All Errors
error_reporting = E_ALL

; Display Errors
display_errors = On

      

0


source


Registering a shutdown handler can also be of great benefit in these situations.

cm

http://php.net/manual/en/function.register-shutdown-function.php

for more details,

By means, you can do some wild stuff with a nice shutdown handler :)

0


source







All Articles