[1040] PDOException in Connection.php line 295

SQLSTATE[HY000] [1040] Too many connections

  1. $this->fetchType = $config['result_type'];
  2. }
  3. try {
  4. if (empty($config['dsn'])) {
  5. $config['dsn'] = $this->parseDsn($config);
  6. }
  7. if ($config['debug']) {
  8. $startTime = microtime(true);
  9. }
  10. $this->links[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $params);
  11. if ($config['debug']) {
  12. // 记录数据库连接信息
  13. Log::record('[ DB ] CONNECT:[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn'], 'sql');
  14. }
  15. } catch (\PDOException $e) {
  16. if ($autoConnection) {
  17. Log::record($e->getMessage(), 'error');
  18. return $this->connect($autoConnection, $linkNum);
  19. } else {

Call Stack

  1. in Connection.php line 295
  2. at PDO->__construct('mysql:host=172.18.0....', 'admin', 'sDd8ao6Gij2H3sdHo5iH...', [0, 2, 0, ...]) in Connection.php line 295
  3. at Connection->connect() in Connection.php line 995
  4. at Connection->initConnect(false) in Connection.php line 348
  5. at Connection->query('SHOW COLUMNS FROM `a...', [], false, true) in Mysql.php line 65
  6. at Mysql->getFields('article_category') in Query.php line 1921
  7. at Query->getTableInfo('article_category', 'pk') in Query.php line 1955
  8. at Query->getPk(['table' => 'article_category', 'field' => ['id', 'name', 'keywords', ...], 'where' => ['AND' => [['exp', object(Expression)]]], ...]) in Query.php line 2639
  9. at Query->find() in NewsCategoryModel.php line 10
  10. at NewsCategoryModel->getDetailByUrl('hlwl') in News.php line 141
  11. at News->detail()
  12. at ReflectionMethod->invokeArgs(object(News), []) in App.php line 343
  13. at App::invokeMethod([object(News), 'detail'], []) in App.php line 611
  14. at App::module(['index', 'news', 'detail'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], false) in App.php line 457
  15. at App::exec(['type' => 'module', 'module' => ['index', 'news', 'detail'], 'convert' => false], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  16. at App::run() in start.php line 19
  17. at require('/data0/www/2898/v3.3...') in index.php line 21

Environment Variables

GET Data
empty
POST Data
empty
Files
empty
Cookies
empty
Session
empty

Server/Request Data

USER
www
HOME
/home/www
FCGI_ROLE
RESPONDER
SCRIPT_FILENAME
/data0/www/2898/v3.3.3/public/index.php
QUERY_STRING
s=/news/hlwl/60156.htm
REQUEST_METHOD
GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME
/index.php
REQUEST_URI
/news/hlwl/60156.htm
DOCUMENT_URI
/index.php
DOCUMENT_ROOT
/data0/www/2898/v3.3.3/public
SERVER_PROTOCOL
HTTP/1.0
REQUEST_SCHEME
http
GATEWAY_INTERFACE
CGI/1.1
SERVER_SOFTWARE
nginx/1.16.1
REMOTE_ADDR
43.248.188.38
REMOTE_PORT
40964
SERVER_ADDR
172.18.0.101
SERVER_PORT
33664
SERVER_NAME
2898.com
REDIRECT_STATUS
200
PHP_ADMIN_VALUE
open_basedir=/data0/www/2898/v3.3.3/public/:/tmp/:/proc/:/data0/www/2898/
HTTP_HOST
www.2898.com
HTTP_X_REAL_IP
175.29.243.169
HTTP_X_FORWARDED_FOR
175.29.243.169
HTTP_REMOTE_HOST
175.29.243.169
HTTP_CONNECTION
close
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
HTTP_ACCEPT
*/*
HTTP_ACCEPT_ENCODING
deflate, gzip
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1606719749.107
REQUEST_TIME
1606719749
PATH_INFO
/news/hlwl/60156.htm
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/data0/www/2898/v3.3.3/public/../application/
CONF_PATH
/data0/www/2898/v3.3.3/public/../conf/
APP_STATE
dev
THINK_VERSION
5.0.24
THINK_START_TIME
1606719749.1091
THINK_START_MEM
263008
EXT
.php
DS
/
THINK_PATH
/data0/www/2898/v3.3.3/thinkphp/
LIB_PATH
/data0/www/2898/v3.3.3/thinkphp/library/
CORE_PATH
/data0/www/2898/v3.3.3/thinkphp/library/think/
TRAIT_PATH
/data0/www/2898/v3.3.3/thinkphp/library/traits/
ROOT_PATH
/data0/www/2898/v3.3.3/
EXTEND_PATH
/data0/www/2898/v3.3.3/extend/
VENDOR_PATH
/data0/www/2898/v3.3.3/vendor/
RUNTIME_PATH
/data0/www/2898/v3.3.3/runtime/
LOG_PATH
/data0/www/2898/v3.3.3/runtime/log/
CACHE_PATH
/data0/www/2898/v3.3.3/runtime/cache/
TEMP_PATH
/data0/www/2898/v3.3.3/runtime/temp/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
CONTROLLER_NAME
news
MODULE_NAME
index
ACTION_NAME
detail