Database Err: SQLSTATE[HY000] [1040] Too many connections
- /www/wwwroot/test.com/protected/lib/speed.php on line 358
353.
try {
354.
if(!class_exists("PDO") || !in_array("mysql",PDO::getAvailableDrivers(), true)){
355.
err('Database Err: PDO or PDO_MYSQL doesn\'t exist!');
356.
}
357.
$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'].'\''));
358.
359.
}catch(PDOException $e){err('Database Err: '.$e->getMessage());}
}
360.
return $GLOBALS['mysql_instances'][$db_config_key];
361.
}
362.
363.
private function _where($conditions){
- /www/wwwroot/test.com/protected/lib/speed.php on line 328
323.
324.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
325.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
326.
$sth = $this->dbInstance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
327.
}else{
328.
329.
$sth = $this->dbInstance($GLOBALS['mysql'], 'master')->prepare($sql);
}
330.
331.
if(is_array($params) && !empty($params)){
332.
foreach($params as $k => &$v){
333.
if(is_int($v)){
- /www/wwwroot/test.com/protected/lib/speed.php on line 320
315.
}
316.
}
317.
return $this->page;
318.
}
319.
320.
321.
public function query($sql, $params = array()){return $this->execute($sql, $params, true);}
public function execute($sql, $params = array(), $readonly = false){
322.
$this->sql[] = $sql;
323.
324.
if($readonly && !empty($GLOBALS['mysql']['MYSQL_SLAVE'])){
325.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
- /www/wwwroot/test.com/protected/lib/speed.php on line 240
235.
$limit = $this->pager($limit[0], $limit[1], $limit[2], $total[0]['M_COUNTER']);
236.
$limit = empty($limit) ? '' : ' LIMIT '.$limit['offset'].','.$limit['limit'];
237.
}else{
238.
$limit = !empty($limit) ? ' LIMIT '.$limit : '';
239.
}
240.
241.
return $this->query('SELECT '. $fields . $sql . $sort . $limit, $conditions["_bindParams"]);
}
242.
243.
public function find($conditions = array(), $sort = null, $fields = '*'){
244.
$res = $this->findAll($conditions, $sort, $fields, 1);
245.
return !empty($res) ? array_pop($res) : false;
- /www/wwwroot/test.com/protected/controller/pc/BaseController.php on line 179
174.
/**
175.
* 获取友情链接
176.
*/
177.
public function getLinks(){
178.
$links = new ZdLinks();
179.
180.
$this->links_txt = $links->findAll(array("linkstatus"=>1,"type"=>1));
$this->links_img = $links->findAll(array("linkstatus"=>1,"type"=>2));
181.
}
182.
}
- /www/wwwroot/test.com/protected/controller/pc/BaseController.php on line 27
22.
"site_description"=>"火羽Hubird专注智能体开发与AI应用落地,提供智能体解决方案、推广案例、技术教程及开发者社区,助力企业高效实现AI自动化转型。探索前沿智能体技术,立即加入全球创新者行列!",
23.
"site_generator"=>"Powered by 火羽Hubird",
24.
"site_author"=>"火羽Hubird",
25.
"locationurl"=>""
26.
);
27.
28.
$this->getLinks();
$this->checkToken();
29.
$this->unread = 0;
30.
$datetime = new DateTime('now', new DateTimeZone('Europe/Paris'));
31.
$this->pt = $datetime->format('c');
32.
$this->_now_time = time();
- /www/wwwroot/test.com/protected/controller/pc/MainController.php on line 100
95.
];
96.
}
97.
}
98.
class MainController extends BaseController {
99.
function __construct(){
100.
101.
parent::__construct();
102.
103.
}
104.
// 在线小工具集合
105.
function actionTools(){
- /www/wwwroot/test.com/protected/lib/speed.php on line 95
90.
header("Location:".$url);
91.
exit;
92.
};
93.
if(!method_exists($controller_name, $action_name))_err_router("Err: Method '$action_name' of '$controller_name' is not exists!");
94.
95.
96.
$controller_obj = new $controller_name();
$controller_obj->$action_name();
97.
98.
if($controller_obj->_auto_display){
99.
$auto_tpl_name = (empty($__module) ? '' : $__module.DS).$__controller.'_'.$__action.'.html';
100.
if(file_exists(APP_DIR.DS.'protected'.DS.'view'.DS.$auto_tpl_name))$controller_obj->display($auto_tpl_name);
- /www/wwwroot/test.com/index.php on line 8
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');