leo80
(Tsantarll)
1
Hello,
I run a site in production mode.
This means that my index.php has the code:
<?php
$yii=dirname(__FILE__).'/../yii/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
require_once($yii);
Yii::createWebApplication($config)->run();
But i recently saw the follow message:
How can i prevent these detail error messages?
Is it yii’s or host server’s configuration?
Thank you.
jneto
(Joel Neto)
2
Hello,
check
http://www.yiiframework.com/doc/guide/1.1/en/topics.error
that kind of error is a YII exception or error. You can add to index.php
define(‘YII_ENABLE_ERROR_HANDLER’,false);
define(‘YII_ENABLE_EXCEPTION_HANDLER’,false);
but them php will show the error.
you can add
ini_set(‘display_errors’, false);
to hide the problem, but you will get a blank page.
My advice:
If you have
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
on main.php config, you can change the
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}
on site controller to hide the error details
leo80
(Tsantarll)
3
Thank you, that was very helpful.