Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused
at line 119 in file classes/db/DbPDO.php
114. public function connect()
115. {
116. try {
117. $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5);
118. } catch (PDOException $e) {
119. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage());
120. }
121.
122. $this->link->exec('SET SESSION sql_mode = \'\'');
123.
124. return $this->link;
375. }
376.
377. $this->result = $this->_query($sql);
378.
379. if (!$this->result && $this->getNumberError() == 2006) {
380. $this->connect();
381. $this->result = $this->_query($sql);
382. }
383.
384. if (_PS_DEBUG_SQL_) {
385. $this->displayError($sql);
659.
660. return $result;
661. }
662. }
663.
664. $this->result = $this->query($sql);
665. if (!$this->result) {
666. $result = false;
667. } else {
668. $result = $this->nextRow($this->result);
669. }
Argument [0] SELECT * FROM `ps_category` a LEFT JOIN `ps_category_lang` `b` ON a.`id_category` = b.`id_category` AND b.`id_lang` = 2 LEFT JOIN `ps_category_shop` `c` ON a.`id_category` = c.`id_category` AND c.`id_shop` = 1 WHERE (a.`id_category` = 3) AND (b.`id_shop` = 1) LIMIT 1
66. // Get shop informations
67. if (Shop::isTableAssociated($entity_defs['table'])) {
68. $sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int) $id_shop);
69. }
70.
71. if ($object_datas = Db::getInstance()->getRow($sql)) {
72. $objectVars = get_object_vars($entity);
73. if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
74. $sql = 'SELECT *
75. FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang`
76. WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int) $id
Argument [0] SELECT * FROM `ps_category` a LEFT JOIN `ps_category_lang` `b` ON a.`id_category` = b.`id_category` AND b.`id_lang` = 2 LEFT JOIN `ps_category_shop` `c` ON a.`id_category` = c.`id_category` AND c.`id_shop` = 1 WHERE (a.`id_category` = 3) AND (b.`id_shop` = 1) LIMIT 1
278. }
279.
280. if ($id) {
281. /** @var \PrestaShop\PrestaShop\Adapter\EntityMapper $entity_mapper */
282. $entity_mapper = ServiceLocator::get('\\PrestaShop\\PrestaShop\\Adapter\\EntityMapper');
283. $entity_mapper->load($id, $this->id_lang, $this, $this->def, $this->id_shop, self::$cache_objects);
284. }
285. }
286.
287. protected function trans($id, array $parameters = [], $domain = null, $locale = null)
288. {
Argument [0]
3
Argument [1]
2
Argument [2]
Category Object
(
[id] =>
[id_category] =>
[name] =>
[active] => 1
[position] =>
[description] =>
[additional_description] =>
[id_parent] =>
[id_category_default] =>
[level_depth] =>
[nleft] =>
[nright] =>
[link_rewrite] =>
[meta_title] =>
[meta_keywords] =>
[meta_description] =>
[date_add] =>
[date_upd] =>
[is_root_category] =>
[id_shop_default] =>
[groupBox] =>
[doNotRegenerateNTree] =>
[id_image] => default
[webserviceParameters:protected] => Array
(
[objectsNodeName] => categories
[hidden_fields] => Array
(
[0] => nleft
[1] => nright
[2] => groupBox
)
[fields] => Array
(
[id_parent] => Array
(
[xlink_resource] => categories
)
[level_depth] => Array
(
[setter] =>
)
[nb_products_recursive] => Array
(
[getter] => getWsNbProductsRecursive
[setter] =>
)
)
[associations] => Array
(
[categories] => Array
(
[getter] => getChildrenWs
[resource] => category
)
[products] => Array
(
[getter] => getProductsWs
[resource] => product
)
)
)
[id_lang:protected] => 2
[lang_associated:protected] =>
[id_shop:protected] => 1
[id_shop_list] => Array
(
)
[get_shop_from_context:protected] => 1
[table:protected] => category
[identifier:protected] => id_category
[fieldsRequired:protected] => Array
(
[0] => active
)
[fieldsSize:protected] => Array
(
)
[fieldsValidate:protected] => Array
(
[nleft] => isUnsignedInt
[nright] => isUnsignedInt
[level_depth] => isUnsignedInt
[active] => isBool
[id_parent] => isUnsignedInt
[id_shop_default] => isUnsignedId
[is_root_category] => isBool
[date_add] => isDate
[date_upd] => isDate
)
[fieldsRequiredLang:protected] => Array
(
[0] => name
[1] => link_rewrite
)
[fieldsSizeLang:protected] => Array
(
[name] => 128
[link_rewrite] => 128
[meta_title] => 255
[meta_description] => 512
[meta_keywords] => 255
)
[fieldsValidateLang:protected] => Array
(
[name] => isCatalogName
[link_rewrite] => isLinkRewrite
[description] => isCleanHtml
[additional_description] => isCleanHtml
[meta_title] => isGenericName
[meta_description] => isGenericName
[meta_keywords] => isGenericName
)
[tables:protected] => Array
(
)
[image_dir:protected] =>
[image_format:protected] => jpg
[translator:protected] =>
[def:protected] => Array
(
[table] => category
[primary] => id_category
[multilang] => 1
[multilang_shop] => 1
[fields] => Array
(
[nleft] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[nright] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[level_depth] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[active] => Array
(
[type] => 2
[validate] => isBool
[required] => 1
)
[id_parent] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[id_shop_default] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[is_root_category] => Array
(
[type] => 2
[validate] => isBool
)
[position] => Array
(
[type] => 1
)
[date_add] => Array
(
[type] => 5
[validate] => isDate
)
[date_upd] => Array
(
[type] => 5
[validate] => isDate
)
[name] => Array
(
[type] => 3
[lang] => 1
[validate] => isCatalogName
[required] => 1
[size] => 128
)
[link_rewrite] => Array
(
[type] => 3
[lang] => 1
[validate] => isLinkRewrite
[required] => 1
[size] => 128
[ws_modifier] => Array
(
[http_method] => 2
[modifier] => modifierWsLinkRewrite
)
)
[description] => Array
(
[type] => 6
[lang] => 1
[validate] => isCleanHtml
)
[additional_description] => Array
(
[type] => 6
[lang] => 1
[validate] => isCleanHtml
)
[meta_title] => Array
(
[type] => 3
[lang] => 1
[validate] => isGenericName
[size] => 255
)
[meta_description] => Array
(
[type] => 3
[lang] => 1
[validate] => isGenericName
[size] => 512
)
[meta_keywords] => Array
(
[type] => 3
[lang] => 1
[validate] => isGenericName
[size] => 255
)
)
[classname] => Category
[associations] => Array
(
[l] => Array
(
[type] => 2
[field] => id_category
[foreign_field] => id_category
)
)
)
[update_fields:protected] =>
[force_id] =>
)
Argument [3]
Array
(
[table] => category
[primary] => id_category
[multilang] => 1
[multilang_shop] => 1
[fields] => Array
(
[nleft] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[nright] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[level_depth] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[active] => Array
(
[type] => 2
[validate] => isBool
[required] => 1
)
[id_parent] => Array
(
[type] => 1
[validate] => isUnsignedInt
)
[id_shop_default] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[is_root_category] => Array
(
[type] => 2
[validate] => isBool
)
[position] => Array
(
[type] => 1
)
[date_add] => Array
(
[type] => 5
[validate] => isDate
)
[date_upd] => Array
(
[type] => 5
[validate] => isDate
)
[name] => Array
(
[type] => 3
[lang] => 1
[validate] => isCatalogName
[required] => 1
[size] => 128
)
[link_rewrite] => Array
(
[type] => 3
[lang] => 1
[validate] => isLinkRewrite
[required] => 1
[size] => 128
[ws_modifier] => Array
(
[http_method] => 2
[modifier] => modifierWsLinkRewrite
)
)
[description] => Array
(
[type] => 6
[lang] => 1
[validate] => isCleanHtml
)
[additional_description] => Array
(
[type] => 6
[lang] => 1
[validate] => isCleanHtml
)
[meta_title] => Array
(
[type] => 3
[lang] => 1
[validate] => isGenericName
[size] => 255
)
[meta_description] => Array
(
[type] => 3
[lang] => 1
[validate] => isGenericName
[size] => 512
)
[meta_keywords] => Array
(
[type] => 3
[lang] => 1
[validate] => isGenericName
[size] => 255
)
)
[classname] => Category
[associations] => Array
(
[l] => Array
(
[type] => 2
[field] => id_category
[foreign_field] => id_category
)
)
)
Argument [4]
1
Argument [5]
1
159. * @param int|null $idLang
160. * @param int|null $idShop
161. */
162. public function __construct($idCategory = null, $idLang = null, $idShop = null)
163. {
164. parent::__construct($idCategory, $idLang, $idShop);
165. $this->image_dir = _PS_CAT_IMG_DIR_;
166. $this->id_image = ($this->id && file_exists($this->image_dir . (int) $this->id . '.jpg')) ? (int) $this->id : false;
167. if (defined('PS_INSTALLATION_IN_PROGRESS')) {
168. $this->doNotRegenerateNTree = true;
169. }
Argument [0] 3 Argument [1] 2 Argument [2]
73. public function init()
74. {
75. $id_category = (int) Tools::getValue('id_category');
76. $this->category = new Category(
77. $id_category,
78. $this->context->language->id
79. );
80.
81. parent::init();
82.
83. if (!Validate::isLoadedObject($this->category) || !$this->category->active) {
Argument [0] 3 Argument [1] 2
295. /**
296. * Starts the controller process (this method should not be overridden!).
297. */
298. public function run()
299. {
300. $this->init();
301. if ($this->checkAccess()) {
302. // setMedia MUST be called before postProcess
303. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
304. $this->setMedia();
305. }
505.
506. // Execute hook dispatcher
507. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
508.
509. // Running controller
510. $controller->run();
511.
512. // Execute hook dispatcher after
513. Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
514. } catch (PrestaShopException $e) {
515. $e->displayMessage();
23. * @copyright Since 2007 PrestaShop SA and Contributors
24. * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
25. */
26.
27. require dirname(__FILE__).'/config/config.inc.php';
28. Dispatcher::getInstance()->dispatch();