Can't make Yii to show error to webbrowser. Configured custom error handler in config:
'errorHandler' => array(
// use 'site/error' action to display errors
'errorAction' => 'site/error',
),
But all errors only got written to application.log and then Apache servers empty page with error 500. How to make Yii print errors to the screen?
index.php:
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
Set YII_DEBUG to true in your index.php and you should be seeing the error stuff come up. Don't forget to change this during production.
(This question is going to get marked as already asked haha)
It might be more of an Apache setting. What you have is correct.
Mine also has this one.
defined('YII_DEBUG_SHOW_PROFILER') or define('YII_DEBUG_SHOW_PROFILER',true);
You can also do this.
error_reporting(E_ALL);
ini_set("display_startup_errors","1");
ini_set("display_errors","1");
You should a little bit modify your config/main.php
. There is an item errorHandler
. It should look like this:
'errorHandler' => [
// use 'site/error' action to display errors
'errorAction' => YII_DEBUG ? null : 'site/error',
],
This happened due to increased priority of CErrorHandler::$errorAction
. Here is discussion: https://github.com/yiisoft/yii/issues/3760
read runtime/logs/app.log you can see any action and error that happens in you yii2 app.