0cean_
0cean_

Reputation: 31

Prestashop localhost giving Refused to Connect error

So I went ahead and transferred my Prestashop (1.6) site from one server to another. I got the database set up and the files fully loaded. When trying to access the server itself, it pulls up no problem. I also see the directory where the Prestashop files are located when accessing the server through the public IP address.

Now, I want to get into the Prestashop store, but I'm getting an error. I have updated my settings.inc.php file in the config directory. It has the correct DB_NAME, DB_USER, DB_PASS. The problem seems to be with the DB_SERVER.

When I set the DB_SERVER to localhost or 127.0.0.1 then I get a 'This site can't be reached' error. Then if I switch the DB_SERVER to the Public IP Address then I get Link to database cannot be established: SQLSTATE[HY000] [2002] Directory Not Found error.

Is there something that I'm missing here? I've scoured the apache2 directory for correct settings and I can't seem to figure it out. Any ideas or suggestions to put me in the right direction?

Upvotes: 0

Views: 3575

Answers (2)

AJoe16
AJoe16

Reputation: 736

As mentioned before (in a previous answer), you have to update both tables "ps_shop_url" and "ps_configuration"

UPDATE `ps_shop_url` set domain="localhost", domain_ssl="localhost" where main=1 and domain="website.com";
UPDATE `ps_shop_url` set physical_uri="/localhost-project-folder/" where main=1 and domain="localhost";
UPDATE `ps_configuration` set value="localhost" WHERE name IN ("PS_SHOP_DOMAIN", "PS_SHOP_DOMAIN_SSL");

I would add the following step: update the "ps_configuration" by disabling SSL:

UPDATE `ps_configuration` set value="0" WHERE name like "PS_SSL_ENABLED";

And make sure to access you localhost project as follows: http://localhost/project/ and not https://localhost/project/ (please note the https).

Upvotes: 1

Alexander Grosul
Alexander Grosul

Reputation: 1814

You must change your store domain information within your database. Look into table ps_configuration and update fields PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL also go to table ps_shop_url and update all necessary information there as well

Upvotes: 1

Related Questions