Database Err: SQLSTATE[HY000] [2002] Connection refused
- /www/wwwroot/qd1d.mtmzf.top/protected/lib/speed.php on line 467
462.
try {
463.
if (!class_exists("PDO") || !in_array("mysql", PDO::getAvailableDrivers(), true)) {
464.
err('Database Err: PDO or PDO_MYSQL doesn\'t exist!');
465.
}
466.
$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'] . '\''));
467.
468.
} catch (PDOException $e) {err('Database Err: ' . $e->getMessage());}
}
469.
return $GLOBALS['mysql_instances'][$db_config_key];
470.
}
471.
472.
private function _where($conditions) {
- /www/wwwroot/qd1d.mtmzf.top/protected/lib/speed.php on line 434
429.
430.
if ($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])) {
431.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
432.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_' . $slave_key)->prepare($sql);
433.
} else {
434.
435.
$sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
}
436.
437.
if (is_array($params) && !empty($params)) {
438.
foreach ($params as $k => &$v) {
439.
if (is_int($v)) {
- /www/wwwroot/qd1d.mtmzf.top/protected/lib/speed.php on line 426
421.
}
422.
}
423.
return $this->page;
424.
}
425.
426.
427.
public function query($sql, $params = array()) {return $this->execute($sql, $params, true);}
public function execute($sql, $params = array(), $readonly = false) {
428.
$this->sql[] = $sql;
429.
430.
if ($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])) {
431.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
- /www/wwwroot/qd1d.mtmzf.top/protected/lib/speed.php on line 328
323.
$limit = $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
324.
$limit = empty($limit) ? '' : ' LIMIT ' . $limit['offset'] . ',' . $limit['limit'];
325.
} else {
326.
$limit = !empty($limit) ? ' LIMIT ' . $limit : '';
327.
}
328.
329.
return $this->query('SELECT ' . $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
}
330.
331.
public function find($conditions = array(), $sort = null, $fields = '*') {
332.
$res = $this->findAll($conditions, $sort, $fields, 1);
333.
return !empty($res) ? array_pop($res) : false;
- /www/wwwroot/qd1d.mtmzf.top/protected/controller/BaseController.php on line 5
1.
<?php
2.
class BaseController extends Controller{
3.
function conf(){
4.
$Config = new Config();
5.
6.
$Config = $Config->findAll();//获取系统配置
$this->conf = array();
7.
foreach($Config as $crow){
8.
//print_r($v);
9.
$this->conf[ $crow['k'] ] = $crow['v'];
10.
}
- /www/wwwroot/qd1d.mtmzf.top/protected/controller/MainController.php on line 4
1.
<?php
2.
class MainController extends BaseController {
3.
function actionIndex(){
4.
5.
$this->conf();
$template = $this->conf['template']?$this->conf['template']:'default';
6.
$filename = TEMPLATE_ROOT.$template.'/index.html';
7.
if(file_exists($filename)){
8.
$this->assets = TEMPLATE_ROOT.$template.'/assets/';
9.
$template_index = $template.'/index.html';
- /www/wwwroot/qd1d.mtmzf.top/protected/lib/speed.php on line 151
146.
if (!method_exists($controller_name, $action_name)) {
147.
_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
148.
}
149.
150.
$controller_obj = new $controller_name();
151.
152.
$controller_obj->$action_name();
153.
if ($controller_obj->_auto_display) {
154.
$auto_tpl_name = (empty($__module) ? '' : $__module . DS) . $__controller . '_' . $__action . '.html';
155.
if (file_exists(APP_DIR . DS . 'protected' . DS . 'view' . DS . $auto_tpl_name)) {
156.
$controller_obj->display($auto_tpl_name);
- /www/wwwroot/qd1d.mtmzf.top/index.php on line 41
36.
}
37.
38.
define('APP_DIR', realpath('./'));
39.
require(APP_DIR.'/protected/Version.php');
40.
require(APP_DIR.'/protected/lib/Common.php');
41.
42.
require(APP_DIR.'/protected/lib/speed.php');
43.
if($_GET['runcron']){
44.
//云端防止监控自动停止
45.
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, ((int)$_SERVER['SERVER_PORT'] == 80 ? 'http://'.$_SERVER['HTTP_HOST'] : 'https://'.$_SERVER['HTTP_HOST']).'/Crontab/Tim/Run?r='.time());curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_TIMEOUT, 1);curl_exec($ch);curl_close($ch);
46.
exit('站点正常哦');