[2002] PDOException in Connection.php line 282

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

  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() in Connection.php line 0
  3. at Connection->connect() in Connection.php line 848
  4. at Connection->initConnect(true) in Mysql.php line 52
  5. at Mysql->getFields('addon_website_banner') in Query.php line 1397
  6. at Query->getTableInfo('addon_website_banner', 'type') in Query.php line 1445
  7. at Query->getFieldsType(['field' => ['id', 'imgurl', 'remark'], 'order' => 'create_at asc', 'table' => 'addon_website_banner', ...]) in Query.php line 1451
  8. at Query->getFieldsBind(['field' => ['id', 'imgurl', 'remark'], 'order' => 'create_at asc', 'table' => 'addon_website_banner', ...]) in Builder.php line 230
  9. at Builder->buildWhere([], ['field' => ['id', 'imgurl', 'remark'], 'order' => 'create_at asc', 'table' => 'addon_website_banner', ...]) in Builder.php line 208
  10. at Builder->parseWhere([], ['field' => ['id', 'imgurl', 'remark'], 'order' => 'create_at asc', 'table' => 'addon_website_banner', ...]) in Builder.php line 600
  11. at Builder->select(['field' => ['id', 'imgurl', 'remark'], 'order' => 'create_at asc', 'table' => 'addon_website_banner', ...]) in Query.php line 1902
  12. at Query->select() in Index.php line 69
  13. at Index->index()
  14. at ReflectionMethod->invokeArgs(object(Index), []) in App.php line 230
  15. at App::invokeMethod(['\addons\website\cont...', 'index']) in App.php line 146
  16. at App::run() in start.php line 18
  17. at require('/data/wwwroot/www.zj...') in index.php line 17

Environment Variables

GET Data
client_id
TestClient
client_secret
TestSecret
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
TEMP
/tmp
TMPDIR
/tmp
TMP
/tmp
PATH
/usr/local/bin:/usr/bin:/bin
USER
www
HOME
/home/www
FCGI_ROLE
RESPONDER
SCRIPT_FILENAME
/data/wwwroot/www.zjnipudun.com/public/index.php
QUERY_STRING
REQUEST_METHOD
GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME
/index.php
REQUEST_URI
/
DOCUMENT_URI
/index.php
DOCUMENT_ROOT
/data/wwwroot/www.zjnipudun.com/public
SERVER_PROTOCOL
HTTP/1.1
REQUEST_SCHEME
https
HTTPS
on
GATEWAY_INTERFACE
CGI/1.1
SERVER_SOFTWARE
nginx/1.12.0
REMOTE_ADDR
154.80.136.34
REMOTE_PORT
20001
SERVER_ADDR
172.26.255.56
SERVER_PORT
443
SERVER_NAME
www.zjnipudun.com
REDIRECT_STATUS
200
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
HTTP_HOST
www.zjnipudun.com
HTTP_ACCEPT
*/*
HTTP_ACCEPT_ENCODING
deflate, gzip
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1591405260.3118
REQUEST_TIME
1591405260
Environment Variablesempty
ThinkPHP Constants
APP_PATH
/data/wwwroot/www.zjnipudun.com/public/../application/
THINK_VERSION
5.0.2
THINK_START_TIME
1591405260.3123
THINK_START_MEM
260152
EXT
.php
DS
/
THINK_PATH
/data/wwwroot/www.zjnipudun.com/thinkphp/
LIB_PATH
/data/wwwroot/www.zjnipudun.com/thinkphp/library/
CORE_PATH
/data/wwwroot/www.zjnipudun.com/thinkphp/library/think/
TRAIT_PATH
/data/wwwroot/www.zjnipudun.com/thinkphp/library/traits/
ROOT_PATH
/data/wwwroot/www.zjnipudun.com/
EXTEND_PATH
/data/wwwroot/www.zjnipudun.com/extend/
VENDOR_PATH
/data/wwwroot/www.zjnipudun.com/vendor/
RUNTIME_PATH
/data/wwwroot/www.zjnipudun.com/runtime/
LOG_PATH
/data/wwwroot/www.zjnipudun.com/runtime/log/
CACHE_PATH
/data/wwwroot/www.zjnipudun.com/runtime/cache/
TEMP_PATH
/data/wwwroot/www.zjnipudun.com/runtime/temp/
CONF_PATH
/data/wwwroot/www.zjnipudun.com/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
ADDON_PATH
/data/wwwroot/www.zjnipudun.com/addons/
IS_PLUGIN
true
PLUGIN_NAME
website