PDA

View Full Version : [SOLVED] Problem during new install, dbhost issue in ez_sql_mysql.php



devnick
04-22-2011, 01:22 AM
I'm setting up a new site on lunarpages (LP) and I'm having an issue.

On new accounts, LP does not use localhost for MySQL database. They store the DB on a different server, so you use a srv.domain.com or ip address for the Database Host

http://wiki.lunarpages.com/Connecting_to_Databases_in_LPCP

It might be that the install program is hard coded to use localhost, not 100% sure yet, but I can't get by the initial screen (1of4). I opted for the manual install way after testing my DB connection with the right values.

Debug shows
PHP Warning: No database selected in /home/t___/public_html/libs/extensions/ezSQL/mysql/ez_sql_mysql.php on line 257

when I look at the code in ez_sql_mysql.php is appears that in several instances, the value for dbhost is hard coded to 'localhost' instead of using what is in the settings file.

function connect($dbuser='', $dbpassword='', $dbhost='localhost')

Is this my problem?

Help...

mabujo
04-22-2011, 09:19 AM
This might seem like an obvious question, but you have set the hostname in hotaru_settings.php, right?

$dbhost='localhost' is just a default parameter to the function you mention. It should get overridden by what you have specified in hotaru_settings.

devnick
04-22-2011, 12:33 PM
yes, i updated hotaru_settings file with the correct value manually before executing the manual install option, using both the srv.domain.com value and then the ip value.

i tested the connection to the database with the code below and it works fine, no problems. [i replaced the actual values with descriptions below].


<?php
$dbhost = '_srv.domain.com_';
$dbuser = '_myuser_';
$dbpass = '_mypassword_';
$dbname = '_mydatabase_';
echo "Connecting to MySQL...<br />";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
echo "Selecting the database...<br />";
mysql_select_db($dbname);
echo "Closing the connection...<br />";
mysql_close($conn);
echo "Finished.";
?>

mabujo
04-22-2011, 12:42 PM
Hmm.

Is the database available outside the host / is it controlled by IP?
Would you be comfortable PMing me the details, otherwise it's kind of hard for me to test...

devnick
04-24-2011, 03:00 PM
Issue resolved!

mabujo
04-24-2011, 04:00 PM
For future reference, I logged into devnick's server and the error was caused by the database user not having the correct rights to access the database.
I'll close the thread as solved.