CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1040] Too many connections

/var/www/ufmrpechora.ru/ygin/yii/db/CDbConnection.php(399)

387                 throw new CDbException('CDbConnection.connectionString cannot be empty.');
388             try
389             {
390                 Yii::trace('Opening DB connection','system.db.CDbConnection');
391                 $this->_pdo=$this->createPdoInstance();
392                 $this->initConnection($this->_pdo);
393                 $this->_active=true;
394             }
395             catch(PDOException $e)
396             {
397                 if(YII_DEBUG)
398                 {
399                     throw new CDbException('CDbConnection failed to open the DB connection: '.
400                         $e->getMessage(),(int)$e->getCode(),$e->errorInfo);
401                 }
402                 else
403                 {
404                     Yii::log($e->getMessage(),CLogger::LEVEL_ERROR,'exception.CDbException');
405                     throw new CDbException('CDbConnection failed to open the DB connection.',(int)$e->getCode(),$e->errorInfo);
406                 }
407             }
408         }
409     }
410 
411     /**

Stack Trace

#7
+
 /var/www/ufmrpechora.ru/ygin/components/BaseActiveRecord.php(24): CActiveRecord->getMetaData()
19    * @param $model CActiveRecord
20    * @return mixed
21    */
22   private static function processModelRelation($model) {
23     $models = isset(Yii::app()->models) ? Yii::app()->models : array();
24     $md = $model->getMetaData();
25     $relations = $md->relations ?? [];
26     foreach($relations AS $name => $relationClass) {
27       if (isset($models[$relationClass->className])) {
28         $className = Yii::import($models[$relationClass->className], false);
29         $relationClass->className = $className;
#8
+
 /var/www/ufmrpechora.ru/ygin/components/BaseActiveRecord.php(56): BaseActiveRecord::processModelRelation(Menu)
51 
52   public function __construct($scenario='insert') {
53     parent::__construct($scenario);
54     if (!self::$_isStart) {
55       self::$_isStart = true;
56       self::processModelRelation($this);
57       self::$_isStart = false;
58     }
59   }
60 
61   public function addValidator(CValidator $validator) {
#10
+
 /var/www/ufmrpechora.ru/ygin/components/BaseActiveRecord.php(40): CActiveRecord::model("Menu")
35 
36   public static function model($className=__CLASS__) {
37     $models = isset(Yii::app()->models) ? Yii::app()->models : array();
38     $className = HArray::val($models, $className, $className);
39     $className = Yii::import($className, true);
40     $model = parent::model($className);
41     // такая обработка будет сделана только в случае когда ::model вызывается первый раз (вызов будет сделан в конструкторе).
42     if (self::$_isStart) $model = self::processModelRelation($model);
43     return $model;
44   }
45   public static function newModel($modelName, $scenario='insert') {
2024-03-29 02:50:59 Caddy/v2.4.6 Yii Framework/1.1.28-dev