CDbException

CDbConnection n'a pu ouvrir la connexion à la base de données : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

/home/apelbell/www/yii/framework/db/CDbConnection.php(382)

370                 throw new CDbException(Yii::t('yii','CDbConnection.connectionString cannot be empty.'));
371             try
372             {
373                 Yii::trace('Opening DB connection','system.db.CDbConnection');
374                 $this->_pdo=$this->createPdoInstance();
375                 $this->initConnection($this->_pdo);
376                 $this->_active=true;
377             }
378             catch(PDOException $e)
379             {
380                 if(YII_DEBUG)
381                 {
382                     throw new CDbException(Yii::t('yii','CDbConnection failed to open the DB connection: {error}',
383                         array('{error}'=>$e->getMessage())),(int)$e->getCode(),$e->errorInfo);
384                 }
385                 else
386                 {
387                     Yii::log($e->getMessage(),CLogger::LEVEL_ERROR,'exception.CDbException');
388                     throw new CDbException(Yii::t('yii','CDbConnection failed to open the DB connection.'),(int)$e->getCode(),$e->errorInfo);
389                 }
390             }
391         }
392     }
393 
394     /**

Stack Trace

#7
+
 /home/apelbell/www/protected/models/Page.php(27): CActiveRecord::model("Page")
22      * @param string $className active record class name.
23      * @return Article the static model class
24      */
25     public static function model($className=__CLASS__)
26     {
27         return parent::model($className);
28     }
29 
30     /**
31      * @return string the associated database table name
32      */
#8
+
 /home/apelbell/www/protected/controllers/SiteController.php(117): Page::model()
112         
113         $this->render('viewPage',array('model'=>$model));
114     }
115     
116     public function loadPage($id) {
117         $model=Page::model()->findByPk($id);
118         if($model===null)
119             throw new CHttpException(404,'Il n\'existe pas la page que vous avez demandé.');
120         return $model;
121     }
122     
#9
+
 /home/apelbell/www/protected/controllers/SiteController.php(105): SiteController->loadPage("4")
100     {
101         $this->render('photos');
102     }
103     
104     public function actionViewpage ($id) {
105         $model = $this->loadPage($id);
106         if($id == 7 || $id >= 10) {                
107             //throw new CHttpException(400,Yii::app()->user->isGuest);
108             if(Yii::app()->user->isGuest == 1 && $model->acces == 1){
109                 throw new CHttpException(400,'Vous n\'avez pas le droit d\'accéder à cette page.');
110             }
2024-03-28 08:58:08 Apache Yii Framework/1.1.10