Zen Cart Logo
Forums / Installing on a Linux/Unix Server / "Unable to connect to database" when pressing Save System Settings

"Unable to connect to database" when pressing Save System Settings

Views: 3,607

Results 21 to 26 of 26
1 Oct 2012, 1:52 AM
#21
tmdea avatar

tmdea

New Zenner

Join Date:
Sep 2012
Posts:
20
Plugin Contributions:
0

"Unable to connect to database" when pressing Save System Settings

DrByte:

That's caused by incorrect database details.
It uses the DB_TYPE, DB_PREFIX, DB_CHARSET, DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE settings when determining where and how to connect.
So, while you said earlier that you'd checked the configure.php, I must ask again: do the DB_XXXXXX settings in your /includes/configure.php file match what you had entered into zc_install during the Database Setup stage?

Yeah it all matches. And the tables are all written after the databse settings part so at the very least at that point the connection details are all correct. But for whatever reason after writing to the DB its no longer able to connect for the system setup on the next step. If the parameters were incorrect wouldnt it have trouble writing the db tables ?

1 Oct 2012, 1:56 AM
#22
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: "Unable to connect to database" when pressing Save System Settings

No, not necessarily.

The part that populates the database directly uses the settings you typed in.
And then it saves those settings to the configure.php file.
And then all the subsequent pages (System Settings, as well as the storefront later) rely on reading that data back in from the configure.php file.

Yours is recognizing the configure.php file as "present". But can't connect to the database when using the information therein.

Maybe you're using special characters in your username/password, and it's getting confused? Try using only letters and numbers and underscores, not any other symbols or spaces.

1 Oct 2012, 2:02 AM
#23
tmdea avatar

tmdea

New Zenner

Join Date:
Sep 2012
Posts:
20
Plugin Contributions:
0

Re: "Unable to connect to database" when pressing Save System Settings

DrByte:

No, not necessarily.

The part that populates the database directly uses the settings you typed in.
And then it saves those settings to the configure.php file.
And then all the subsequent pages (System Settings, as well as the storefront later) rely on reading that data back in from the configure.php file.

Yours is recognizing the configure.php file as "present". But can't connect to the database when using the information therein.

Maybe you're using special characters in your username/password, and it's getting confused? Try using only letters and numbers and underscores, not any other symbols or spaces.

the username is 5 lowercase letters. The password is all letters with the exeption that the first character is a number. I am willing to PM you the username and password, which you can probably see in the video anyway, and you are welcome to try the setup wizard yourself if you are interested in looking at it yourself. All of this is currently set up on a temporary account for testing purposes so I wouldnt mnd letting you look under the hood.

1 Oct 2012, 3:04 AM
#24
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: "Unable to connect to database" when pressing Save System Settings

Found it.

Your server has that stupid APC caching system enabled, and so all the PHP files, including the configure.php file, were serving up OLD content, and so the server was trying to connect to the database using bad info that it had cached.

** BEST FIX: Get your server admin to completely disable APC and any other PHP caching from your hosting account.**

ALTERNATE FIX: add the following line to the top of the following files:

<?php if (function_exists('apc_clear_cache')) @apc_clear_cache(); ?>

/zencart/index.php
/zencart/zc_install/index.php
/zencart/admin/includes/application_top.php

1 Oct 2012, 3:42 AM
#25
tmdea avatar

tmdea

New Zenner

Join Date:
Sep 2012
Posts:
20
Plugin Contributions:
0

Re: "Unable to connect to database" when pressing Save System Settings

I'll confirm success after deleting 1.3 and working with 1.5 again for any future references to someone having the problem.

1 Oct 2012, 4:22 AM
#26
tmdea avatar

tmdea

New Zenner

Join Date:
Sep 2012
Posts:
20
Plugin Contributions:
0

Re: "Unable to connect to database" when pressing Save System Settings

tmdea:

I'll confirm success after deleting 1.3 and working with 1.5 again for any future references to someone having the problem.

OK problem solved using the php directives. Will try with the APC disabling when my admin becomes available tomorrow. Thanks again.