Page 1 of 1

Unable to create SQL dayfile table

Posted: Mon 12 Mar 2018 4:24 pm
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.

Re: Unable to create SQL dayfile table

Posted: Mon 12 Mar 2018 5:11 pm
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.

Re: Unable to create SQL dayfile table

Posted: Fri 16 Mar 2018 2:09 pm
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.

Re: Unable to create SQL dayfile table

Posted: Fri 16 Mar 2018 2:21 pm
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

Re: Unable to create SQL dayfile table

Posted: Fri 16 Mar 2018 5:04 pm
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

Re: Unable to create SQL dayfile table

Posted: Fri 16 Mar 2018 6:28 pm
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?

Re: Unable to create SQL dayfile table

Posted: Sat 17 Mar 2018 10:19 am
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

Re: Unable to create SQL dayfile table

Posted: Sun 18 Mar 2018 8:42 pm
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?

Re: Unable to create SQL dayfile table

Posted: Tue 20 Mar 2018 4:59 pm
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'?