主页 > 库存新闻 >

CDbException

来源:收购库存回收网络整理作者:回收库存发布时间:2020-08-23 18:24

 

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

/var/www/news.wugu.com.cn/protected/controllers/new/zx/2016/NewsBaseController.php(14)

02 class NewsBaseController extends WuguControllerBase 03 { 04 public $domain = "news.wugu.com.cn"; 05 public $fragment_ids = "670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,756,760,787,788,789"; 06 07 /** 08 * 获取新闻分类信息 09 */ 10 public function GetNewsCategory() 11 { 12 $info = array(); 13 $sql = "SELECT id,`name`,uname from cms_category WHERE `status` =1"; 14 $info = $this->getApp()->db->createCommand($sql)->queryAll (); 15 return $info; 16 } 17 18 /** 19 * 碎片内容 20 */ 21 public function getpage() 22 { 23 $apiObj = ApiOperator::__instance ()->get ( array ('api' => ApiDefine::$FRAGMENT_GET_LIST, 'ids' => $this->fragment_ids ) ); 24 $fragmentsArray = JsonParser::objectToArray ( $apiObj->data ); //碎片内容 25 $pagearr = array (); 26 foreach ( $fragmentsArray as $key => $v ) {

Stack Trace #0  

+

 /var/www/yii/framework/db/CDbConnection.php(330): CDbConnection->open()

325 public function setActive($value) 326 { 327 if($value!=$this->_active) 328 { 329 if($value) 330 $this->open(); 331 else 332 $this->close(); 333 } 334 } 335

 
#1  

+

 /var/www/yii/framework/db/CDbConnection.php(308): CDbConnection->setActive(true)

303 */ 304 public function init() 305 { 306 parent::init(); 307 if($this->autoConnect) 308 $this->setActive(true); 309 } 310 311 /** 312 * Returns whether the DB connection is established. 313 * @return boolean whether the DB connection is established

 
#2  

+

 /var/www/yii/framework/base/CModule.php(387): CDbConnection->init()

382 if(!isset($config['enabled']) || $config['enabled']) 383 { 384 Yii::trace("Loading \"$id\" application component",'system.CModule'); 385 unset($config['enabled']); 386 $component=Yii::createComponent($config); 387 $component->init(); 388 return $this->_components[$id]=$component; 389 } 390 } 391 } 392

 
#3  

+

 /var/www/yii/framework/base/CModule.php(103): CModule->getComponent("db")

098 * @return mixed the named property value 099 */ 100 public function __get($name) 101 { 102 if($this->hasComponent($name)) 103 return $this->getComponent($name); 104 else 105 return parent::__get($name); 106 } 107 108 /**

 
#4  

+

 /var/www/news.wugu.com.cn/protected/controllers/new/zx/2016/NewsBaseController.php(14): CModule->__get("db")

09 */ 10 public function GetNewsCategory() 11 { 12 $info = array(); 13 $sql = "SELECT id,`name`,uname from cms_category WHERE `status` =1"; 14 $info = $this->getApp()->db->createCommand($sql)->queryAll (); 15 return $info; 16 } 17 18 /** 19 * 碎片内容

 
#5  

+

 /var/www/news.wugu.com.cn/protected/controllers/new/zx/2016/NewsBaseController.php(304): NewsBaseController->GetNewsCategory()

299 300 301 $data = $this->getApp()->cache->get($key); 302 if(empty($data)) 303 { 304 $type_info = $this->GetNewsCategory(); 305 $str = ""; 306 foreach ($type_info as $key=>&$val) 307 { 308 /*if(isset($params) && !empty($params['expect_category_id']) && in_array($val['id'], $params['expect_category_id'])) 309 {

 
#6  

+