Database Err: SQLSTATE[HY000] [2002] Connection refused
- /www/wwwroot/bs-api.brick4.com/protected/lib/speed.php on line 324
319.
try {
320.
if(!class_exists("PDO") || !in_array("mysql",PDO::getAvailableDrivers(), true)){
321.
err('Database Err: PDO or PDO_MYSQL doesn\'t exist!');
322.
}
323.
$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'].'\''));
324.
325.
}catch(PDOException $e){err('Database Err: '.$e->getMessage());}
}
326.
return $GLOBALS['mysql_instances'][$db_config_key];
327.
}
328.
329.
private function _where($conditions){
- /www/wwwroot/bs-api.brick4.com/protected/lib/speed.php on line 295
290.
$this->sql[] = $sql;
291.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
292.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
293.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
294.
}else{
295.
296.
$sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
}
297.
298.
if(is_array($params) && !empty($params)){
299.
foreach($params as $k => &$v){
300.
if(is_int($v)){
- /www/wwwroot/bs-api.brick4.com/protected/lib/speed.php on line 288
283.
}
284.
}
285.
return $this->page;
286.
}
287.
288.
289.
public function query($sql, $params = array()){return $this->execute($sql, $params, true);}
public function execute($sql, $params = array(), $readonly = false){
290.
$this->sql[] = $sql;
291.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
292.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
293.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
- /www/wwwroot/bs-api.brick4.com/protected/lib/speed.php on line 210
205.
$limit = $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
206.
$limit = empty($limit) ? '' : ' LIMIT '.$limit['offset'].','.$limit['limit'];
207.
}else{
208.
$limit = !empty($limit) ? ' LIMIT '.$limit : '';
209.
}
210.
211.
return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
}
212.
213.
public function find($conditions = array(), $sort = null, $fields = '*'){
214.
$res = $this->findAll($conditions, $sort, $fields, 1);
215.
return !empty($res) ? array_pop($res) : false;
- /www/wwwroot/bs-api.brick4.com/protected/controller/MainController.php on line 27
22.
23.
24.
25.
//已收录品牌
26.
//$r_brand = $brand->findAll(array( "state" => "1", "top > 0" ), "top DESC");
27.
28.
$r_brand = $brand->findAll(array(), "top DESC");
//$r_brand = $brand->findAll();
29.
$tmp_brand_array = [];
30.
foreach ($r_brand as $r_brand_v) {
31.
$tmp_brand_array[$r_brand_v["id"]]["title"] = $r_brand_v["title"];
32.
$tmp_brand_array[$r_brand_v["id"]]["logo"] = $r_brand_v["logo"];
- /www/wwwroot/bs-api.brick4.com/protected/lib/speed.php on line 76
71.
}
72.
if(!is_available_classname($__controller))_err_router("Err: Controller '$controller_name' is not correct!");
73.
if(!class_exists($controller_name, true))_err_router("Err: Controller '$controller_name' is not exists!");
74.
if(!method_exists($controller_name, $action_name))_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
75.
$controller_obj = new $controller_name();
76.
77.
$controller_obj->$action_name();
if($controller_obj->_auto_display){
78.
$auto_tpl_name = (empty($__module) ? '' : $__module.DS).$__controller.'_'.$__action.'.html';
79.
if(file_exists(APP_DIR.DS.'protected'.DS.'view'.DS.$auto_tpl_name))$controller_obj->display($auto_tpl_name);
80.
}
81.
function url($c = 'main', $a = 'index', $param = array()){
- /www/wwwroot/bs-api.brick4.com/index.php on line 5
1.
<?php
2.
include("301.inc.php");
3.
session_start();
4.
define('APP_DIR', realpath('./'));
5.
require(APP_DIR.'/protected/lib/speed.php');