Jump to content

Constant Error 500 - " 136. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage()); "


Recommended Posts

Hello,

I very often encounter the following Error 500 on my website since a few days (main page and backoffice) :

 

[PrestaShopException]

Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused
at line 136 in file classes/db/DbPDO.php

131. public function connect()
132. {
133. try {
134. $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5);
135. } catch (PDOException $e) {
136. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage());
137. }
138.
139. $this->link->exec('SET SESSION sql_mode = \'\'');
140.
141. return $this->link;

 

Does anyone know why and how I could fix this? 

Thank you very much in advance!!

Link to comment
Share on other sites

  • razaro changed the title to Constant Error 500 - " 136. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage()); "

As you can see the database connection does not work. If you hav not changed anything on the database (password for example) you should ask your hosting provided if the db is up and running

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...