Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Unable to create SQL dayfile table

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
forestedge
Posts: 104
Joined: Sun 29 Jul 2012 11:46 am
Weather Station: Davis Vantage Pro2 Plus DFARS
Operating System: Windows 10 64 bit
Location: Ashurst Bridge, Hampshire UK
Contact:

Unable to create SQL dayfile table

Post by forestedge »

I have been unable to create the dayfile SQL database running ImportCumulusFile.php and get the following error.
[12-Mar-2018 16:11:01 Europe/London] PHP Fatal error: Uncaught Error: Call to undefined function apache_setenv() in /home/tottonwe/public_html/ImportCumulusFile.php:193
Stack trace:
#0 {main}
thrown in /home/tottonwe/public_html/ImportCumulusFile.php on line 193
Line 193 is
@apache_setenv('no-gzip', 1);
and should not be edited according to the readme.
Server is running php 5.6.34 and MySQL 5.6.38

I have also tried creating database from within MX but get an error on saving settings
error[objectOBJECT]
Any help appreciated please.
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Unable to create SQL dayfile table

Post by mcrossley »

Yep, I am testing a version of the script that fixes that error. However, if you are running MX, then it can create the tables for you anyway in the MySQL settings. The only thing you need the script for with MX is importing historic data.

Try deleting line 193 from the script, it may just fix it, though there may be an adjacent line that needs to go as well - can't recall without digging out the scripts.
forestedge
Posts: 104
Joined: Sun 29 Jul 2012 11:46 am
Weather Station: Davis Vantage Pro2 Plus DFARS
Operating System: Windows 10 64 bit
Location: Ashurst Bridge, Hampshire UK
Contact:

Re: Unable to create SQL dayfile table

Post by forestedge »

Thanks, deleting line 193 sorted that out but now getting error message
Running from web server
Script start: 16/03/18 - 12:43:33
Importing file: /Data/dayfile.txt, To table: dayfile ...
Error: Failed to open file: '/Data/dayfile.txt'
Script complete: 16/03/18 - 12:43:33
Execution time: 0 secs
Still getting the error[objectOBJECT] when trying to create table from within MX as well.

I could try importing direct into MySQL but there are a range of formats for the db format with MyISAM as default.
Others include CSV and InnoDB.
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Unable to create SQL dayfile table

Post by mcrossley »

looks like you have given an absolute path to your day file, but from the root it looks like it should be something like...

/home/tottonwe/public_html/Data/dayfile.txt

and remember it is case sensitive
forestedge
Posts: 104
Joined: Sun 29 Jul 2012 11:46 am
Weather Station: Davis Vantage Pro2 Plus DFARS
Operating System: Windows 10 64 bit
Location: Ashurst Bridge, Hampshire UK
Contact:

Re: Unable to create SQL dayfile table

Post by forestedge »

The same error message appears with the full path and other variations!

The error log is showing
[16-Mar-2018 16:49:18 Europe/London] PHP Warning: mysqli::__construct(): (28000/1045): Access denied for user 'username'@'localhost' (using password: YES) in /home/tottonwe/public_html/ImportCumulusFile.php on line 252
Line 252 is
$mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $database);
Seems odd that settings cannot be saved from within MX either using:
localhost
Port 21
User: tottonwe_name
Password:XXXX
Database:tottonwe_dayfile
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Unable to create SQL dayfile table

Post by sfws »

I don't use MX, so cannot advise re that aspect.
My database has a different schema to that Mark uses, so I cannot help with anything specifically relating to that aspect either.
But maybe something I say below might still help you?
forestedge wrote:Database:tottonwe_dayfile
Presumably that is a database name rather than the name of a table within the database?
Does this database exist yet? If the database exists, but not tables within it, maybe you can use a tool like "phpMyAdmin" to look at it. How you get to that tool (if you have it) depends on your server set up, and so I can't tell you exactly what to type in. That can sometimes confirm that user and password for access are correct. It might also help to diagnose any permissions related issue?
If the database does not exist, "phpmyadmin" can create a database, and could create a test table for you (you might be able to copy structure from "ImportCumulusFile.php").
forestedge wrote:I could try importing direct into MySQL but there are a range of formats for the db format with MyISAM as default.
Others include CSV and InnoDB.
I don't know whether it matters, but I'm using "InnoDB" for all my database accesses, and the PHP I use has some resemblance with that "ImportCumulusFile.php" uses, and I guess therefore matches https://cumulus.hosiene.co.uk/viewtopic.p ... 15#p107639
forestedge wrote:The same error message appears with the full path and other variations!
Presumably you have already successfully put the dayfile onto your server? How did you do that? Surely, instead of just trying different path names, you (with administrative access) should be able to find and read it on your server, that will guide you to how the PHP import could find it. I don't know whether using a file transfer tool could help with finding it?
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Unable to create SQL dayfile table

Post by Mapantz »

It looks to me that you need to white-list your IP address in the 'Remote MySQL' settings on cpanel to allow you to connect and insert data.

12.345.%

etc
Image
forestedge
Posts: 104
Joined: Sun 29 Jul 2012 11:46 am
Weather Station: Davis Vantage Pro2 Plus DFARS
Operating System: Windows 10 64 bit
Location: Ashurst Bridge, Hampshire UK
Contact:

Re: Unable to create SQL dayfile table

Post by forestedge »

Thanks for the responses on this.
Database:tottonwe_dayfile
Presumably that is a database name rather than the name of a table within the database?
Does this database exist yet? If the database exists, but not tables within it, maybe you can use a tool like "phpMyAdmin" to look at it. How you get to that tool (if you have it) depends on your server set up, and so I can't tell you exactly what to type in.
Yes it was the database name now changed to tottonwe_Dayfile to avoid confusion. I can create a table in MYSQL but not save it because it gives message "Missing value in form!"
If the database does not exist, "phpmyadmin" can create a database, and could create a test table for you (you might be able to copy structure from "ImportCumulusFile.php").
See above.
I don't know whether it matters, but I'm using "InnoDB" for all my database accesses, and the PHP I use has some resemblance with that "ImportCumulusFile.php" uses, and I guess therefore matches https://cumulus.hosiene.co.uk/viewtopic.p ... 15#p107639
I changed to InnoDB but no difference!
Presumably you have already successfully put the dayfile onto your server? How did you do that? Surely, instead of just trying different path names, you (with administrative access) should be able to find and read it on your server, that will guide you to how the PHP import could find it. I don't know whether using a file transfer tool could help with finding it?
I have to use MYSQL through cpanel, it is not visible using Filezilla unfortunately.
It looks to me that you need to white-list your IP address in the 'Remote MySQL' settings on cpanel to allow you to connect and insert data.
12.345.%
This looked promising as my IP address was not in Remote MySQL so I added it and also tried a % but still no change.

A couple other points
1. What import format should be specified for dayfile.txt direct into MYSQL assuming I could save the table?
2. I have checked user id has privileges. Database tottonwe_Dayfile has no privileges listed, does it need any?
User avatar
jdc
Posts: 142
Joined: Tue 19 Jun 2012 8:51 pm
Weather Station: Davis VP2 : Instromet
Operating System: Win 10
Location: Portsoy,.
Contact:

Re: Unable to create SQL dayfile table

Post by jdc »

I'm assuming that you're accessing a db on a remote webserver and you can access the db via the control panel. The error message seems more like a credential problem.
If so, are you sure 'localhost' is correct as hostname and not something like 'db1234.1and1.com'?
Locked