CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'mysql' (65)

/framework/db/CDbConnection.php(381)

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

Stack Trace

#7
+
 /protected/models/Page.php(10): CActiveRecord::model("Page")
05   public $title;
06   public $text;
07   
08   public static function model($className=__CLASS__)
09     {
10     return parent::model($className);
11     }
12     // Указываем имя таблицы с которой работает данная модель
13   public function tableName()
14     {
15     return 'page'; // таблица "posts"
#8
+
 /protected/controllers/PageController.php(447): Page::model()
442         }
443         $criteria = new CDbCriteria;  
444         $criteria->condition ="name = 'contact'";
445 
446         $view['model'] = $model;
447         $view['Page'] = Page::model()->find($criteria);
448         
449         $this->render('contact', $view);
450     }
451 
452     /**
#21
+
 /index.php(12): CApplication->run()
07 defined('YII_DEBUG') or define('YII_DEBUG',true);
08 // specify how many levels of call stack should be shown in each log message
09 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
10 
11 require_once($yii);
12 Yii::createWebApplication($config)->run();
2018-05-22 12:44:05 Apache/1.3.37 (Unix) mod_ssl/2.8.28 OpenSSL/0.9.6b mod_fastcgi/2.4.2 Yii Framework/1.1.13