CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

/var/www/html/protected/libs/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/utils/Host.php(17): CActiveRecord->findByAttributes(array("host" => "tambov.rodina.ru"))
12         }
13 
14         static $site;
15 
16         if (!$site) {
17             $site = Site::model()->findByAttributes(array('host' => $matches['host']));
18 
19         }
20 
21         if (!$site) {
22             return false;
#8
+
 /var/www/html/protected/components/BaseController.php(20): Host::getCurrentSite("tambov.rodina.ru")
15 
16     public function init()
17     {
18         parent::init();
19         
20         $this->currentSite = $site = Host::getCurrentSite($_SERVER['HTTP_HOST']);
21 
22         $this->mainSite = $mainSite = Site::getMainSite();
23 
24         if (!$site) {
25 
#9
+
 /var/www/html/protected/controllers/SiteController.php(20): BaseController->init()
15     public $bugReportForm;
16 
17     public $slogan;
18 
19     public function init() {
20         parent::init();
21 
22         if (!Yii::app()->user->isGuest && Yii::app()->user->getState('role') == 'user') {
23             $this->siteUser = User::model()->with(['avatar', 'cityInfo'])->findByPk(Yii::app()->user->id, 'deleted IS NULL');
24         } elseif (!Yii::app()->user->isGuest && Yii::app()->user->getState('role') == 'admin') {
25             $admin = Admin::model()->with('user')->findByPk(Yii::app()->user->id);
2024-03-29 15:35:53 Apache/2.4.7 (Ubuntu) Yii Framework/1.1.14