Database Err: SQLSTATE[HY000] [2002] No such file or directory

373.              try {
374.                  if(!class_exists("PDO") || !in_array("mysql",PDO::getAvailableDrivers(), true)){
375.                      err('Database Err: PDO or PDO_MYSQL doesn\'t exist!');
376.                  }
377.                  $GLOBALS['mysql_instances'][$db_config_key] = new PDO('mysql:dbname='.$db_config['MYSQL_DB'].';host='.$db_config['MYSQL_HOST'].';port='.$db_config['MYSQL_PORT'], $db_config['MYSQL_USER'], $db_config['MYSQL_PASS'], array(PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES \''.$db_config['MYSQL_CHARSET'].'\''));
378.              }catch(PDOException $e){err('Database Err: '.$e->getMessage());}
379.          }
380.          return $GLOBALS['mysql_instances'][$db_config_key];
381.      }
382.      
383.      private function _where($conditions){
343. 
344.          if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
345.              $slave_key array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
346.              $sth $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
347.          }else{
348.              $sth $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
349.          }
350.          
351.          if(is_array($params) && !empty($params)){
352.              foreach($params as $k => &$v){
353.                  if(is_int($v)){
335.              }
336.          }
337.          return $this->page;
338.      }
339.      
340.      public function query($sql$params = array()){return $this->execute($sql$paramstrue);}
341.      public function execute($sql$params = array(), $readonly false){
342.          $this->sql[] = $sql;
343. 
344.          if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
345.              $slave_key array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
255.              $limit $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
256.              $limit = empty($limit) ? '' ' LIMIT '.$limit['offset'].','.$limit['limit'];            
257.          }else{
258.              $limit = !empty($limit) ? ' LIMIT '.$limit '';
259.          }
260.          return $this->query('SELECT '$fields $sql $sort $limit$conditions["_bindParams"]);
261.      }
262.      
263.      public function find($conditions = array(), $sort null$fields '*'){
264.          $res $this->findAll($conditions$sort$fields1);
265.          return !empty($res) ? array_pop($res) : false;
259.          }
260.          return $this->query('SELECT '$fields $sql $sort $limit$conditions["_bindParams"]);
261.      }
262.      
263.      public function find($conditions = array(), $sort null$fields '*'){
264.          $res $this->findAll($conditions$sort$fields1);
265.          return !empty($res) ? array_pop($res) : false;
266.      }
267.      
268.      public function update($conditions$row){
269.          $values = array();
16.          $redisData $redisObj->get($cacheKey);
17.          $redisData "";
18.          $bookDetail = [];
19.          if(empty($redisData)){
20.              $book = new Book(); 
21.              $bookDetail $book->find(["id"=>$bookId]);
22.              $redisObj->set($cacheKey,json_encode($bookDetail),60*60*24);
23.          }else{
24.              $bookDetail json_decode($redisData,true);
25.          }
26.          $this->book $bookDetail;
111.      // exit;
112.  };
113.  if(!method_exists($controller_name$action_name))_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
114. 
115.  $controller_obj = new $controller_name();
116.  $controller_obj->$action_name();
117. 
118.  if($controller_obj->_auto_display){
119.      $auto_tpl_name = (empty($__module) ? '' $__module.DS).$__controller.'_'.$__action.'.html';
120.      if(file_exists(APP_DIR.DS.'protected'.DS.'view'.DS.$auto_tpl_name))$controller_obj->display($auto_tpl_name);
121.  }
3.  header('Access-Control-Allow-Origin: *');
4.  header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
5.  header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
6.  define('APP_DIR'realpath('./'));
7.  define("APP_PATH",dirname(__FILE__));
8.  require(APP_DIR.'/protected/lib/speed.php');