[2013] PDOException in Connection.php line 293

SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111

  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 293
  2. at PDO->__construct('mysql:dbname=hefapow...', 'SUNSHING', 'Stamcdq2qdTa2NWQ', [0, 2, 0, ...]) in Connection.php line 293
  3. at Connection->connect() in Connection.php line 968
  4. at Connection->initConnect(false) in Mysql.php line 54
  5. at Mysql->getFields('hf_hf_web_setting') in Query.php line 1739
  6. at Query->getTableInfo('hf_hf_web_setting', 'type') in Query.php line 1787
  7. at Query->getFieldsType(['field' => ['value', 'code'], 'multi' => ['AND' => ['type' => ['system']]], 'where' => ['AND' => ['type' => 'system']], ...]) in Query.php line 1793
  8. at Query->getFieldsBind(['field' => ['value', 'code'], 'multi' => ['AND' => ['type' => ['system']]], 'where' => ['AND' => ['type' => 'system']], ...]) in Builder.php line 254
  9. at Builder->buildWhere(['AND' => ['type' => 'system']], ['field' => ['value', 'code'], 'multi' => ['AND' => ['type' => ['system']]], 'where' => ['AND' => ['type' => 'system']], ...]) in Builder.php line 224
  10. at Builder->parseWhere(['AND' => ['type' => 'system']], ['field' => ['value', 'code'], 'multi' => ['AND' => ['type' => ['system']]], 'where' => ['AND' => ['type' => 'system']], ...]) in Builder.php line 673
  11. at Builder->select(['field' => ['value', 'code'], 'multi' => ['AND' => ['type' => ['system']]], 'where' => ['AND' => ['type' => 'system']], ...]) in Query.php line 2305
  12. at Query->select() in News.php line 21
  13. at News->_initialize() in Controller.php line 56
  14. at Controller->__construct(object(Request))
  15. at ReflectionClass->newInstanceArgs([object(Request)]) in App.php line 215
  16. at App::invokeClass('app\index\controller...') in Loader.php line 420
  17. at Loader::controller('news', 'controller', false, 'Error') in App.php line 386
  18. at App::module('index/news/catlist//...', ['app_debug' => true, 'app_trace' => false, 'app_status' => '', ...], null) in App.php line 295
  19. at App::exec(['type' => 'module', 'module' => 'index/news/catlist//...'], ['app_debug' => true, 'app_trace' => false, 'app_status' => '', ...]) in App.php line 123
  20. at App::run() in start.php line 18
  21. at require('/mnt/www/hefapower/t...') in index.php line 17

Environment Variables

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

Server/Request Data

REDIRECT_PATH_INFO
news/catlist/c_id/2.html
REDIRECT_STATUS
200
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
HTTP_HOST
www.hefapower.com
HTTP_ACCEPT
*/*
HTTP_ACCEPT_ENCODING
deflate, gzip
PATH
/sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE
SERVER_SOFTWARE
Apache
SERVER_NAME
www.hefapower.com
SERVER_ADDR
120.76.97.182
SERVER_PORT
80
REMOTE_ADDR
154.213.183.253
DOCUMENT_ROOT
/mnt/www/hefapower
SERVER_ADMIN
root@localhost
SCRIPT_FILENAME
/mnt/www/hefapower/index.php
REMOTE_PORT
20000
REDIRECT_URL
/news/catlist/c_id/2.html
GATEWAY_INTERFACE
CGI/1.1
SERVER_PROTOCOL
HTTP/1.1
REQUEST_METHOD
GET
QUERY_STRING
REQUEST_URI
/news/catlist/c_id/2.html
SCRIPT_NAME
/index.php
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1576101762.989
REQUEST_TIME
1576101762
PATH_INFO
news/catlist/c_id/2.html
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/mnt/www/hefapower/application/
THINK_VERSION
5.0.9
THINK_START_TIME
1576101762.9919
THINK_START_MEM
254824
EXT
.php
DS
/
THINK_PATH
/mnt/www/hefapower/thinkphp/
LIB_PATH
/mnt/www/hefapower/thinkphp/library/
CORE_PATH
/mnt/www/hefapower/thinkphp/library/think/
TRAIT_PATH
/mnt/www/hefapower/thinkphp/library/traits/
ROOT_PATH
/mnt/www/hefapower/
EXTEND_PATH
/mnt/www/hefapower/extend/
VENDOR_PATH
/mnt/www/hefapower/vendor/
RUNTIME_PATH
/mnt/www/hefapower/runtime/
LOG_PATH
/mnt/www/hefapower/runtime/log/
CACHE_PATH
/mnt/www/hefapower/runtime/cache/
TEMP_PATH
/mnt/www/hefapower/runtime/temp/
CONF_PATH
/mnt/www/hefapower/application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false