Is there any way that i can redirect to some page on database connection error. I am trying to do this error handling since 2 days but i did not get success.
In my config file following code is specified.
‘errorHandler’=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
public function actionError() {
if ($error = Yii::app()->errorHandler->error) {
if (Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}
This function is already available in my SiteController. I was checking the access_log but i don’t see any entry for the site/error in there. So may be this function is not being called somehow.
Specific error i am getting is as followed.
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2013] Lost connection to MySQL server at ‘reading initial communication packet’, system error: 111