Link to database cannot be established:SQLSTATE[HY000] [2002] Connection refused
at line 102 in file classes/db/DbPDO.php
97. public function connect()
98. {
99. try {
100. $this->link = $this->_getPDO($this->server, $this->user, $this->password, $this->database, 5);
101. } catch (PDOException $e) {
102. throw new PrestaShopException('Link to database cannot be established:'.$e->getMessage());
103. }
104.
105. // UTF-8 support
106. if ($this->link->exec('SET NAMES \'utf8\'') === false) {
107. throw new PrestaShopException('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.');
367. }
368.
369. $this->result = $this->_query($sql);
370.
371. if (!$this->result && $this->getNumberError() == 2006) {
372. if ($this->connect()) {
373. $this->result = $this->_query($sql);
374. }
375. }
376.
377. if (_PS_DEBUG_SQL_) {
591. throw new PrestaShopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries');
592. }
593. return $this->execute($sql, $use_cache);
594. }
595.
596. $this->result = $this->query($sql);
597.
598. if (!$this->result) {
599. $result = false;
600. } else {
601. if (!$array) {
Argument [0] SELECT gs.*, s.*, gs.name AS group_name, s.name AS shop_name, s.active, su.domain, su.domain_ssl, su.physical_uri, su.virtual_uri FROM ps1724_shop_group gs LEFT JOIN ps1724_shop s ON s.id_shop_group = gs.id_shop_group LEFT JOIN ps1724_shop_url su ON s.id_shop = su.id_shop AND su.main = 1 WHERE s.deleted = 0 AND gs.deleted = 0 ORDER BY gs.name, s.name
687. WHERE s.deleted = 0
688. AND gs.deleted = 0
689. '.$where.'
690. ORDER BY gs.name, s.name';
691.
692. if ($results = Db::getInstance()->executeS($sql)) {
693. foreach ($results as $row) {
694. if (!isset(self::$shops[$row['id_shop_group']])) {
695. self::$shops[$row['id_shop_group']] = array(
696. 'id' => $row['id_shop_group'],
697. 'name' => $row['group_name'],
Argument [0] SELECT gs.*, s.*, gs.name AS group_name, s.name AS shop_name, s.active, su.domain, su.domain_ssl, su.physical_uri, su.virtual_uri FROM ps1724_shop_group gs LEFT JOIN ps1724_shop s ON s.id_shop_group = gs.id_shop_group LEFT JOIN ps1724_shop_url su ON s.id_shop = su.id_shop AND su.main = 1 WHERE s.deleted = 0 AND gs.deleted = 0 ORDER BY gs.name, s.name
743. * @param bool $get_as_list_id
744. * @return array
745. */
746. public static function getShops($active = true, $id_shop_group = null, $get_as_list_id = false)
747. {
748. Shop::cacheShops();
749.
750. $results = array();
751. foreach (self::$shops as $group_id => $group_data) {
752. foreach ($group_data['shops'] as $id => $shop_data) {
753. if ((!$active || $shop_data['active']) && (!$id_shop_group || $id_shop_group == $group_id)) {
278. *
279. * @return array Values for all shops
280. */
281. public static function getMultiShopValues($key, $idLang = null)
282. {
283. $shops = Shop::getShops(false, null, true);
284. $resultsArray = array();
285. foreach ($shops as $idShop) {
286. $resultsArray[$idShop] = Configuration::get($key, $idLang, null, $idShop);
287. }
288.
Argument [0] Argument [1] Argument [2] 1
375. }
376. }
377.
378. $http_host = Tools::getHttpHost();
379. $all_media = array_merge(
380. Configuration::getMultiShopValues('PS_MEDIA_SERVER_1'),
381. Configuration::getMultiShopValues('PS_MEDIA_SERVER_2'),
382. Configuration::getMultiShopValues('PS_MEDIA_SERVER_3')
383. );
384.
385. if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || Tools::isPHPCLI() || in_array($http_host, $all_media)) {
Argument [0] PS_MEDIA_SERVER_1
115.
116. $context = Context::getContext();
117.
118. /* Initialize the current Shop */
119. try {
120. $context->shop = Shop::initialize();
121. } catch (PrestaShopException $e) {
122. $e->displayMessage();
123. }
124. define('_THEME_NAME_', $context->shop->theme->getName());
125. define('_PARENT_THEME_NAME_', $context->shop->theme->get('parent') ?: '');
22. * @copyright 2007-2017 PrestaShop SA
23. * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
24. * International Registered Trademark & Property of PrestaShop SA
25. */
26.
27. require(dirname(__FILE__).'/config/config.inc.php');
28. Dispatcher::getInstance()->dispatch();
Argument [0] /var/www/admin/www/demo2.best-kit.com/presta1724/config/config.inc.php