You are here:  » Database connection


Database connection

Submitted by gahanpip on Mon, 2015-06-08 02:47 in

I'm having difficulty getting the database to connect, tried the suggestions in by the previous person but no joy - I'm using a VPS server for the first time and not had any real problems before connecting the database...
Checking database connection...

FAIL check $config_databaseUsername and $config_databasePassword values
Checking database selection...FAIL
Checking database tables...FAIL

Checked all the settings and can't see anything different from what I have dome before when the script ran perfectly -

Philip

Submitted by support on Mon, 2015-06-08 06:50

Hello Philip,

Apologies for the delay in your post appearing - I do moderate all posts / comments before publishing in order to protect customer's information / URLs etc.

What turned out to be the case with the previous person's query regarding database connection was actually a server mis-configuration - the mysqli default socket path setting in php.ini was different to the actual socket path being used by MySQL. Whilst this can be overridden at run time, it can only be done so if mysqli_connect() is called with no parameters, so everything has to be set via ini_set overrides.

I'll email you in just a moment with the details of the work-around for this, and then if that's not the case I'll check it out further with you of course;

Cheers,
David.
--
PriceTapestry.com

Submitted by gahanpip on Mon, 2015-06-08 07:03

Thank you

Submitted by gahanpip on Tue, 2015-06-09 20:19

eventually got the new VPS server running and put a fresh install of pricetapestry on with all the emended files but get the message...

Fatal error: Call to undefined function mysqli_connect() in {code saved}/database.php on line 16

Philip

Submitted by support on Tue, 2015-06-09 20:30

Hi Philip,

That error message implies that MySQL libraries have not been installed as part of the server's PHP / Apache configuration.

If you have root access to your server, you should be able to do this from the command line as follows:

apt-get install php5-mysql

...or if your server uses yum as the package manager:

yum install php5-mysql

In both cases, "php5-mysql" might need to be just "php-mysql" depending on how your server's Linux distribution is set-up.

After installing additional PHP modules it's best to do a full stop / start of Apache - I've often found that the restart triggers invoked by apt-get / yum don't always have the same effect - commands would normally be:

service httpd stop
service httpd start

As above, depending on server configuration "httpd" might be "apache2" instead.

That should be all it is. If it's a managed VPS your host should be able to apply the above for you (just ask for PHP MySQL libraries to be installed) but if you're still not sure or if you are not familiar with command line server configuration just let me know and I'll check it out further with you.

Cheers,
David.
--
PriceTapestry.com