CDbException

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

/home/ahjktwet/domains/inli.ir/public_html/portal/protected/components/StartupBehavior.php(17)

05         {
06                 // set the event callback
07                 $owner->attachEventHandler('onBeginRequest', array($this, 'beginRequest'));
08         }
09 
10         /**
11          * This method is attached to the 'onBeginRequest' event above.
12          **/
13         public function beginRequest(CEvent $event)
14         {
15              $urlManager = Yii::app()->getUrlManager();
16              $sql='select * from {{article}} where status="1"';
17              $result=Yii::app()->db->createCommand($sql)->queryAll();
18              
19                //echo '<pre>';print_r($result);die;
20                 if($result) {
21                     $rules = array();
22                     foreach($result as $row)
23                     {
24                      $alias= $row['alias'];  
25                      if(!empty($alias))
26                      {
27                           $alias=str_replace(' ','-',$alias);
28                           $rules[$alias]='article/article/view/id/'.$row['article_id'];
29 

Stack Trace

#4
+
 /home/ahjktwet/domains/inli.ir/public_html/portal/protected/components/StartupBehavior.php(17): CModule->__get("db")
12          **/
13         public function beginRequest(CEvent $event)
14         {
15              $urlManager = Yii::app()->getUrlManager();
16              $sql='select * from {{article}} where status="1"';
17              $result=Yii::app()->db->createCommand($sql)->queryAll();
18              
19                //echo '<pre>';print_r($result);die;
20                 if($result) {
21                     $rules = array();
22                     foreach($result as $row)
#8
+
 /home/ahjktwet/domains/inli.ir/public_html/portal/index.php(26): CApplication->run()
21 defined('YII_DEBUG') or define('YII_DEBUG',true);
22 // specify how many levels of call stack should be shown in each log message
23 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
24 
25 require_once($yii);
26 Yii::createWebApplication($config)->run();
2026-05-25 03:20:20 LiteSpeed Yii Framework/1.1.19