Page 1 of 1

ImportCumulusFile.php can't connect to DB

Posted: Tue 12 Dec 2017 2:54 am
by PaulMy
I have had Toolbox Remote Command run ImportCumulusFile.php to import the realtime.txt and dayfile.txt to my GoDaddy MySQL database and that has worked well. I have recently updated my hosting to cPanel and everything is working again, except the DB import is giving a
12/12/17 - 01:42:07
Importing to table: realtime ...
Processing realtimefile: realtime.txt
Error: Failed to connect to the database server
The Toolbox Remote Command settings have not been changed.

In ImportCumulusFile.php I have only changed $dbhost and $dbpassword from:

Code: Select all

// EDIT THIS NEXT SECTION CAREFULLY
// ----------------------------------------------------------------
// Your security key you will pass in the URL, change this to
// something unique to you
$key = 'a unique key';
// The server host name or number running your MySQL database
// usually 127.0.0.1 or localhost will suffice
$dbhost = 'KomokaWeather.db.5379896.hostedresource.com';
// The username used to log-in to your database server
$dbuser = 'KomokaWeather';
// The password used to log-in to your database server
$dbpassword	= 'my unique password';
// The name of the MySQL database we will store the tables in
$database = 'KomokaWeather';
to:

Code: Select all

// EDIT THIS NEXT SECTION CAREFULLY
// ----------------------------------------------------------------
// Your security key you will pass in the URL, change this to
// something unique to you
$key = 'same unique key';
// The server host name or number running your MySQL database
// usually 127.0.0.1 or localhost will suffice
$dbhost = 'localhost';
// The username used to log-in to your database server
$dbuser = 'KomokaWeather';
// The password used to log-in to your database server
$dbpassword	= 'my unique password for new database';
// The name of the MySQL database we will store the tables in
$database = 'KomokaWeather';
I have talked to GoDaddy and they say to use "localhost" for the new hosting, and have double checked my Username and Password. Have I missed something or are other changes to be made in either Toolbox or ImportCumulusFile.php?

Thanks,
Paul

Re: ImportCumulusFile.php can't connect to DB

Posted: Tue 12 Dec 2017 12:11 pm
by weatherist34
Hello Paul

Have a look in phpmyadmin right the very top on the left hand side and you can check the if it is localhost in use .

Select the database you want to use

You can also see the database name sometimes host will insert username_database i.e brıan_weather you may also see localhost:3306 in the host

Discovered recently no one standard for various hosts I’ve always used localhost but recently I have seen many variations when helping others over the last few months .

Brian

Re: ImportCumulusFile.php can't connect to DB

Posted: Tue 12 Dec 2017 5:00 pm
by PaulMy
Thanks Brian. GoDaddy had mentioned it should be just localhost and I think I have this issue resolved now. I had to do some refresh on my cPanel hosting MySQL DB settings and that seemed to have fixed it, and also change dbconfig as some of my scripts use this file. Imports seem to be current in the various DB tables.

I'll take a little break before I update to PHP 7x which I can now do with cPanel hosting, as I suspect there will be some issues when I do that.

Enjoying again,
Paul

Re: ImportCumulusFile.php can't connect to DB

Posted: Tue 12 Dec 2017 8:30 pm
by weatherist34
PaulMy wrote:Thanks Brian. GoDaddy had mentioned it should be just localhost and I think I have this issue resolved now. I had to do some refresh on my cPanel hosting MySQL DB settings and that seemed to have fixed it, and also change dbconfig as some of my scripts use this file. Imports seem to be current in the various DB tables.

I'll take a little break before I update to PHP 7x which I can now do with cPanel hosting, as I suspect there will be some issues when I do that.

Enjoying again,
Paul
Hello Paul

Glad you got that sorted, has for php 7 most common error is non numerical values particularly where scripts calculate where the original values that are non numerical particularly differences and multipliers it easily fixed introducing a number_format or rounding apart prior to making any calculations apart from that nothing major should go wrong.

Brian..