Exception

Database Exceptionyii\db\Exception

SQLSTATE[HY000] [2002] Connection refused

  • 1. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Connection.php at line 534
    525526527528529530531532533534535536537538539540541542543
            $token = 'Opening DB connection: ' . $this->dsn;
            try {
                Yii::info($token, __METHOD__);
                Yii::beginProfile($token, __METHOD__);
                $this->pdo = $this->createPdoInstance();
                $this->initConnection();
                Yii::endProfile($token, __METHOD__);
            } catch (\PDOException $e) {
                Yii::endProfile($token, __METHOD__);
                throw new Exception($e->getMessage(), $e->errorInfo, (int) $e->getCode(), $e);
            }
        }
     
        /**
         * Closes the currently active DB connection.
         * It does nothing if the connection is already closed.
         */
        public function close()
        {
    
  • 2. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Connection.php yii\db\Connection::open() at line 836
    830831832833834835836837838839840841842
         * Returns the PDO instance for the currently active master connection.
         * This method will open the master DB connection and then return [[pdo]].
         * @return PDO the PDO instance for the currently active master connection.
         */
        public function getMasterPdo()
        {
            $this->open();
            return $this->pdo;
        }
     
        /**
         * Returns the currently active slave connection.
         * If this method is called the first time, it will try to open a slave connection when [[enableSlaves]] is true.
    
  • 3. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Connection.php yii\db\Connection::getMasterPdo() at line 823
    817818819820821822823824825826827828829
         * is available and `$fallbackToMaster` is false.
         */
        public function getSlavePdo($fallbackToMaster = true)
        {
            $db = $this->getSlave(false);
            if ($db === null) {
                return $fallbackToMaster ? $this->getMasterPdo() : null;
            } else {
                return $db->pdo;
            }
        }
     
        /**
    
  • 4. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Schema.php yii\db\Connection::getSlavePdo() at line 444
    438439440441442443444445446447448449450
        public function quoteValue($str)
        {
            if (!is_string($str)) {
                return $str;
            }
     
            if (($value = $this->db->getSlavePdo()->quote($str)) !== false) {
                return $value;
            } else {
                // the driver doesn't support quote (e.g. oci)
                return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'";
            }
        }
    
  • 5. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Connection.php yii\db\Schema::quoteValue('633b2c01f2662519755faab9fc605604') at line 732
    726727728729730731732733734735736737738
         * @param string $value string to be quoted
         * @return string the properly quoted string
         * @see http://www.php.net/manual/en/function.PDO-quote.php
         */
        public function quoteValue($value)
        {
            return $this->getSchema()->quoteValue($value);
        }
     
        /**
         * Quotes a table name for use in a query.
         * If the table name contains schema prefix, the prefix will also be properly quoted.
         * If the table name is already quoted or contains special characters including '(', '[[' and '{{',
    
  • 6. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Command.php yii\db\Connection::quoteValue('633b2c01f2662519755faab9fc605604') at line 164
    158159160161162163164165166167168169170
            if (empty($this->params)) {
                return $this->_sql;
            }
            $params = [];
            foreach ($this->params as $name => $value) {
                if (is_string($value)) {
                    $params[$name] = $this->db->quoteValue($value);
                } elseif ($value === null) {
                    $params[$name] = 'NULL';
                } elseif (!is_object($value) && !is_resource($value)) {
                    $params[$name] = $value;
                }
            }
    
  • 7. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Command.php yii\db\Command::getRawSql() at line 794
    788789790791792793794795796797798799800
         * @return mixed the method execution result
         * @throws Exception if the query causes any problem
         * @since 2.0.1 this method is protected (was private before).
         */
        protected function queryInternal($method, $fetchMode = null)
        {
            $rawSql = $this->getRawSql();
     
            Yii::info($rawSql, 'yii\db\Command::query');
     
            if ($method !== '') {
                $info = $this->db->getQueryCacheInfo($this->queryCacheDuration, $this->queryCacheDependency);
                if (is_array($info)) {
    
  • 8. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Command.php yii\db\Command::queryInternal('fetch', null) at line 363
    357358359360361362363364365366367368369
         * @return array|boolean the first row (in terms of an array) of the query result. False is returned if the query
         * results in nothing.
         * @throws Exception execution failed
         */
        public function queryOne($fetchMode = null)
        {
            return $this->queryInternal('fetch', $fetchMode);
        }
     
        /**
         * Executes the SQL statement and returns the value of the first column in the first row of data.
         * This method is best used when only a single value is needed for a query.
         * @return string|null|boolean the value of the first column in the first row of the query result.
    
  • 9. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/Query.php yii\db\Command::queryOne() at line 243
    237238239240241242243244245246247248249
         * If this parameter is not given, the `db` application component will be used.
         * @return array|boolean the first row (in terms of an array) of the query result. False is returned if the query
         * results in nothing.
         */
        public function one($db = null)
        {
            return $this->createCommand($db)->queryOne();
        }
     
        /**
         * Returns the query result as a scalar value.
         * The value returned will be the first column in the first row of the query results.
         * @param Connection $db the database connection used to generate the SQL statement.
    
  • 10. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/db/ActiveQuery.php yii\db\Query::one(null) at line 285
    279280281282283284285286287288289290291
         * @return ActiveRecord|array|null a single row of query result. Depending on the setting of [[asArray]],
         * the query result may be either an array or an ActiveRecord object. Null will be returned
         * if the query results in nothing.
         */
        public function one($db = null)
        {
            $row = parent::one($db);
            if ($row !== false) {
                $models = $this->populate([$row]);
                return reset($models) ?: null;
            } else {
                return null;
            }
    
  • 11. in /www/users/HA208131/WEB/frontend/yii/UrlRule.php yii\db\ActiveQuery::one() at line 26
    20212223242526272829303132
     
        	$pathInfo=trim($pathInfo,'/');
     
        	$html_md5=md5($pathInfo);
     
        	$condition['html_md5']=$html_md5;
        	$model=UrlModel::find()->andwhere($condition)->one();
        	if($model==null){
        		return false;
        	}
     
        	$params=unserialize($model->php);
        	$routes=$params[0];
    
  • 12. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/web/UrlManager.php – frontend\yii\UrlRule::parseRequest(yii\web\UrlManager, yii\web\Request) at line 234
    228229230231232233234235236237238239240
        public function parseRequest($request)
        {
            if ($this->enablePrettyUrl) {
                $pathInfo = $request->getPathInfo();
                /* @var $rule UrlRule */
                foreach ($this->rules as $rule) {
                    if (($result = $rule->parseRequest($this, $request)) !== false) {
                        return $result;
                    }
                }
     
                if ($this->enableStrictParsing) {
                    return false;
    
  • 13. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/web/Request.php yii\web\UrlManager::parseRequest(yii\web\Request) at line 180
    174175176177178179180181182183184185186
         * Resolves the current request into a route and the associated parameters.
         * @return array the first element is the route, and the second is the associated parameters.
         * @throws NotFoundHttpException if the request cannot be resolved.
         */
        public function resolve()
        {
            $result = Yii::$app->getUrlManager()->parseRequest($this);
            if ($result !== false) {
                list ($route, $params) = $result;
                $_GET = $params + $_GET; // preserve numeric keys
     
                return [$route, $_GET];
            } else {
    
  • 14. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/web/Application.php yii\web\Request::resolve() at line 75
    69707172737475767778798081
         * @return Response the resulting response
         * @throws NotFoundHttpException if the requested route is invalid
         */
        public function handleRequest($request)
        {
            if (empty($this->catchAll)) {
                list ($route, $params) = $request->resolve();
            } else {
                $route = $this->catchAll[0];
                $params = $this->catchAll;
                unset($params[0]);
            }
            try {
    
  • 15. in /www/users/HA208131/WEB/vendor/yiisoft/yii2/base/Application.php yii\web\Application::handleRequest(yii\web\Request) at line 375
    369370371372373374375376377378379380381
            try {
     
                $this->state = self::STATE_BEFORE_REQUEST;
                $this->trigger(self::EVENT_BEFORE_REQUEST);
     
                $this->state = self::STATE_HANDLING_REQUEST;
                $response = $this->handleRequest($this->getRequest());
     
                $this->state = self::STATE_AFTER_REQUEST;
                $this->trigger(self::EVENT_AFTER_REQUEST);
     
                $this->state = self::STATE_SENDING_RESPONSE;
                $response->send();
    
  • 16. in /www/users/HA208131/WEB/index.php yii\base\Application::run() at line 32
    26272829303132
    			require(__DIR__ . '/frontend/config/main.php'),
    			require(__DIR__ . '/frontend/config/main-local.php')
    	);
    }
     
    $application = new yii\web\Application($config);
    $application->run();
    
  • $_GET = [
        'gsxw' => '',
    ];
    
    $_SERVER = [
        'REDIRECT_REDIRECT_UNIQUE_ID' => 'Xwj25n8AAAEAAEoXZKEAAAAN',
        'REDIRECT_REDIRECT_STATUS' => '200',
        'REDIRECT_UNIQUE_ID' => 'Xwj25n8AAAEAAEoXZKEAAAAN',
        'REDIRECT_HANDLER' => 'application/x-httpd-php5',
        'REDIRECT_STATUS' => '200',
        'UNIQUE_ID' => 'Xwj25n8AAAEAAEoXZKEAAAAN',
        'HTTP_USER_AGENT' => 'Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)',
        'HTTP_HOST' => 'www.pclcud.com',
        'HTTP_ACCEPT' => '*/*',
        'HTTP_ACCEPT_ENCODING' => 'deflate, gzip',
        'PATH' => '/usr/local/jdk/bin:/usr/local/jdk/bin:/sbin:/usr/sbin:/bin:/usr/bin:/bin:/bin',
        'SERVER_SIGNATURE' => '',
        'SERVER_SOFTWARE' => 'Apache',
        'SERVER_NAME' => 'www.pclcud.com',
        'SERVER_ADDR' => '122.114.221.247',
        'SERVER_PORT' => '80',
        'REMOTE_ADDR' => '154.210.125.164',
        'DOCUMENT_ROOT' => '/www/users/HA208131/WEB',
        'SERVER_ADMIN' => 'vhost@zzidc.com',
        'SCRIPT_FILENAME' => '/www/users/HA208131/WEB/index.php',
        'REMOTE_PORT' => '20001',
        'REDIRECT_QUERY_STRING' => 'gsxw',
        'REDIRECT_URL' => '/index.php',
        'GATEWAY_INTERFACE' => 'CGI/1.1',
        'SERVER_PROTOCOL' => 'HTTP/1.1',
        'REQUEST_METHOD' => 'GET',
        'QUERY_STRING' => 'gsxw',
        'REQUEST_URI' => '/gsxw',
        'SCRIPT_NAME' => '/index.php',
        'ORIG_SCRIPT_FILENAME' => '/usr/local/zend/php5.5/bin/php-cgi',
        'ORIG_PATH_INFO' => '/index.php',
        'ORIG_PATH_TRANSLATED' => '/www/users/HA208131/WEB/index.php',
        'ORIG_SCRIPT_NAME' => '/php55-cgi',
        'PHP_SELF' => '/index.php',
        'REQUEST_TIME_FLOAT' => 1594423014.8134291,
        'REQUEST_TIME' => 1594423014,
    ];