CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory

/var/www/html/yii/framework/db/CDbConnection.php(382)

370                 throw new CDbException('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('CDbConnection failed to open the DB connection: '.
383                         $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('CDbConnection failed to open the DB connection.',(int)$e->getCode(),$e->errorInfo);
389                 }
390             }
391         }
392     }
393 
394     /**

Stack Trace

#7
+
 /var/www/html/protected/components/BaseController.php(430): CActiveRecord->findAll(array("condition" => "t.status = 2", "with" => array("song" => array("select" => "id, singer_id, name, popularity, ranking, publish_year"), "song.performers" => array("select" => "id, name")), "select" => "id, create_time, view_count"))
425     }
426 
427     public function getTopScoreLists($sizePerList = 10){
428 
429         $scores = Score::model()->findAll(array(
430             'condition' => 't.status = 2',
431             'with' => array(
432                 'song' => array('select' => 'id, singer_id, name, popularity, ranking, publish_year'),
433                 'song.performers' => array('select' => 'id, name')
434             ),
435             'select' => 'id, create_time, view_count',
#8
+
 /var/www/html/protected/components/BaseController.php(16): BaseController->getTopScoreLists()
11     protected function beforeAction($action){
12 
13         parent::beforeAction($action);
14 
15         $this->title = $this->seo;
16         $this->rankings = $this->getTopScoreLists();
17         $this->auto_song_list = $this->getSongNameIdList();
18 
19         return true;
20     }
21 
#15
+
 /var/www/html/index.php(20): CApplication->run()
15 ini_set('memory_limit', '256M');
16 date_default_timezone_set('Asia/Hong_Kong'); 
17 
18 require_once($yii);
19 set_time_limit(180);
20 Yii::createWebApplication($config)->run();
21 
22 
2024-03-28 19:10:00 Apache/2.4.18 (Ubuntu) Yii Framework/1.1.14