CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

/home/freespar/www/protected/components/MyUrlRule.php(23)

11             if (isset($params["name_$lang"]))
12                 return $params["name_$lang"];
13         }
14         return false;  // this rule does not apply
15     }
16  
17     public function parseUrl($manager,$request,$pathInfo,$rawPathInfo)
18     {
19         $lang = Yii::app()->getLanguage();
20         if(preg_match('%^[a-z0-9\-]+$%', $pathInfo, $matches))
21         {
22             $adress=$matches[0];
23             $command=Yii::app()->{$this->connectionID}->createCommand();
24             $result=$command->select("name_$lang")->from('pages');
25             $result->where("name_$lang=:name_$lang", array("name_$lang"=>$adress));
26             $result = $result->queryRow();
27             if(!empty($result)&&$result["name_$lang"]===$adress)
28             {
29                 $_GET["name_$lang"]=$result["name_$lang"];
30                 return 'pages/view/id/'.$this->getId($adress);
31             }
32         }
33         return false;  // this rule does not apply
34     }
35     

Stack Trace

#4
+
 /home/freespar/www/protected/components/MyUrlRule.php(23): CModule->__get("db")
18     {
19         $lang = Yii::app()->getLanguage();
20         if(preg_match('%^[a-z0-9\-]+$%', $pathInfo, $matches))
21         {
22             $adress=$matches[0];
23             $command=Yii::app()->{$this->connectionID}->createCommand();
24             $result=$command->select("name_$lang")->from('pages');
25             $result->where("name_$lang=:name_$lang", array("name_$lang"=>$adress));
26             $result = $result->queryRow();
27             if(!empty($result)&&$result["name_$lang"]===$adress)
28             {
#8
+
 /home/freespar/www/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();
2024-03-29 12:43:04 Apache Yii Framework/1.1.14