[2002] PDOException in Connection.php line 282

SQLSTATE[HY000] [2002] Network is unreachable

  1. $this->resultSetType = $config['resultset_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 282
  2. at PDO->__construct('mysql:dbname=dltest0...', 'dltest008_zhcs_', 'x2sNeTf5bXWwjakp', [0, 2, 0, ...]) in Connection.php line 282
  3. at Connection->connect() in Connection.php line 845
  4. at Connection->initConnect(true) in Mysql.php line 52
  5. at Mysql->getFields('hat_single') in Query.php line 1482
  6. at Query->getTableInfo('hat_single', 'pk') in Query.php line 1516
  7. at Query->getPk(['table' => 'hat_single', 'where' => [], 'field' => '*', ...]) in Query.php line 1719
  8. at Query->parsePkWhere(1, ['table' => 'hat_single', 'where' => [], 'field' => '*', ...]) in Query.php line 2039
  9. at Query->find(1) in Model.php line 1079
  10. at Model::get(1) in Connect.php line 30
  11. at Connect->_initialize() in Controller.php line 57
  12. at Controller->__construct(object(Request))
  13. at ReflectionClass->newInstanceArgs([object(Request)]) in App.php line 253
  14. at App::invokeClass('app\home\controller\...') in Loader.php line 410
  15. at Loader::controller('connect', 'controller', false, 'Error') in App.php line 379
  16. at App::module(['home', 'connect', 'ndetails'], ['app_namespace' => 'app', 'app_debug' => true, 'app_trace' => false, ...], null) in App.php line 140
  17. at App::run() in start.php line 18
  18. at require('/home/www/wwwroot/dl...') in index.php line 22

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
FCGI_ROLE RESPONDER
SCRIPT_FILENAME /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/index.php
QUERY_STRING s=/home/connect/ndetails/nid/24/id/104.html
REQUEST_METHOD GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME /index.php
REQUEST_URI /home/connect/ndetails/nid/24/id/104.html
DOCUMENT_URI /index.php
DOCUMENT_ROOT /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn
SERVER_PROTOCOL HTTP/1.1
REQUEST_SCHEME http
GATEWAY_INTERFACE CGI/1.1
SERVER_SOFTWARE nginx/1.14.2
REMOTE_ADDR 192.168.5.249
REMOTE_PORT 38270
SERVER_ADDR 192.168.5.206
SERVER_PORT 80
SERVER_NAME dltest008.zhcs.lcweb01.cn
REDIRECT_STATUS 200
PATH_INFO /home/connect/ndetails/nid/24/id/104.html
HTTP_ACCEPT */*
HTTP_USER_AGENT claudebot
HTTP_HOST dltest008.zhcs.lcweb01.cn
HTTP_X_FORWARDED_FOR 54.82.44.149
HTTP_CONNECTION close
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711657914.2165
REQUEST_TIME 1711657914
Environment Variablesempty
ThinkPHP Constants
APP_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/application/
RUNTIME_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/runtime/
EXTEND_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/extend/
APP_DEBUG true
THINK_VERSION 5.0.4
THINK_START_TIME 1711657914.2171
THINK_START_MEM 262216
EXT .php
DS /
THINK_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/thinkphp/
LIB_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/thinkphp/library/
CORE_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/thinkphp/library/think/
TRAIT_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/thinkphp/library/traits/
ROOT_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/
VENDOR_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/vendor/
LOG_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/runtime/log/
CACHE_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/runtime/cache/
TEMP_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/runtime/temp/
CONF_PATH /home/www/wwwroot/dl/dltest008.zhcs.lcweb02.cn/application/
CONF_EXT .php
ENV_PREFIX PHP_
IS_CLI false
IS_WIN false