Can't create Input on new install of Windows

A new install of emoncms on Windows.  I was able to create the first admin user.  I can login and logout and go to all the pages but if I send "http://localhost:8080/input/post.json?node=1&csv=100,200,300" (Apache running on port 8080) I get an OK back in the browser but no input is created.

Does emoncms create any error or event logs? How can I troubleshoot this?

Mattia Rossi's picture

Re: Can't create Input on new install of Windows

Hi,

Make sure you include the apikey parameter with the read&write key you find in this page: http://localhost/emoncms/input/api

Regards

Automate's picture

Re: Can't create Input on new install of Windows

Thanks for the help.  Since the browser is running on the same computer (localhost) as emoncms, I did not think the apikey is required.

I tried it again with the read/write api key and get the same result.  Browser returns OK but no Input created.

I'm wondering if it is a DB security issue but I am connected as root so I would not think so.

TrystanLea's picture

Re: Can't create Input on new install of Windows

Sounds like something went wrong with the install if the input is not being created, can you look directly at your database, are the table's being created ok? Do other features work, like creating users, login, creating dashboards etc?

 

Automate's picture

Re: Can't create Input on new install of Windows

Thanks for the help,  Using Workbench it looks like all the tables have been created but they are all empty except for the "users" table.  It has the logins that have been registered.

All the pages seem to work (Input, Feeds, Vis, Dashboard, Account) but I think there is only so much I can do before an Input is created.

Automate's picture

Re: Can't create Input on new install of Windows

One more quirk.  Using Chrome, I can't login with the "Remember me" check box checked.  I get a red bar with no text in it.

Automate's picture

Re: Can't create Input on new install of Windows

Another user is having the same problem on Windows

http://openenergymonitor.org/emon/node/2500

Automate's picture

Re: Can't create Input on new install of Windows

I think I may have found something.  In input_model.php there is a create_input function that includes

INSERT INTO input (userid,name,nodeid) VALUES ('$userid','$name','$nodeid')

But in the input table the description and record fields are marked as "Not Null"

When I changed the input table to allow Null for description and record the input is created.

Should these fields be Nullable and why is no one else not seeing this problem on Linux?

 

Automate's picture

Re: Can't create Input on new install of Windows

Now that I have an input when I use the input web page to create a feed with the "Create New" selection I get a pop-up with just "undefined" and no feed is created.

Robert Wall's picture

Re: Can't create Input on new install of Windows

I can't help thinking that there is something missing from your installation. Can I suggest you try installing again, you can keep your existing version and put the new emoncms in a subdirectory of your WAMP space. You will use the same MySQL of course, but create a separate new database for the new version.

Automate's picture

Re: Can't create Input on new install of Windows

Just to be sure I tried to reinstall but still have the same problems.

 

I have identified at least one problem with the source code in Github.

The create_input function in input_model.php tries to create an input with this

INSERT INTO input (userid,name,nodeid) VALUES ('$userid','$name','$nodeid')

But input_schema.php creates the input table with "No nulls" allowed for "description" and "record" as shown below

$schema['input'] = array(
  'id' => array('type' => 'int(11)', 'Null'=>'NO', 'Key'=>'PRI', 'Extra'=>'auto_increment'),
  'userid' => array('type' => 'text'),
  'name' => array('type' => 'text'),
  'description' => array('type' => 'text', 'Null'=>'NO', 'default'=>''),
  'nodeid' => array('type' => 'int(11)'),
  'processList' => array('type' => 'text'),
  'time' => array('type' => 'datetime'),
  'value' => array('type' => 'float'),
  'record' => array('type' => 'tinyint(1)',  'Null'=>'NO', 'default'=>false)
);

At least on Windows MySQL 5.6 both "description" and "record" are created without any default value.  So an INSERT without specifying these values will fail.

Robert Wall's picture

Re: Can't create Input on new install of Windows

I'm running emoncms 5, downloaded on 15th May, under WampServer 2.2 (Apache is V 2.2.21, PHP is V 5.3.10, MySQL is V 5.5.20) and Windows XP, and didn't have any problems. I don't know MySQL nor emoncms well enough to know whether that is wrong or whether your problem lies elsewhere. I was under the impression that inputs were named automatically with the name being constructed from the node and the order the values arrive if nothing else is specified in the input stream, and description can be empty (is that the same as NULL?).

 

Automate's picture

Re: Can't create Input on new install of Windows

Did you install with a blank database or did you already have an existing one?

 

Also, there was a minor change to input_model.php on 20th May.

Robert Wall's picture

Re: Can't create Input on new install of Windows

I started with a totally new database. (Trystan says the database was extended to accommodate "Remember me", hence the one time conversion procedure.)

Did you follow http://emoncms.org/site/docs/installwindows ?

Automate's picture

Re: Can't create Input on new install of Windows

Yes, I used those directions.

Does your input table look like this?

 

 

Robert Wall's picture

Re: Can't create Input on new install of Windows

Mine looks nothing like that! though the database columns look the same. If I could guess the column headings for the properties that you have it might help. This is what mine looks like:

 

Robert Wall's picture

Re: Can't create Input on new install of Windows

I have just installed the very latest emoncms and everything appears to be OK using the old Wampserver and database.

Automate's picture

Re: Can't create Input on new install of Windows

Said by Robert Wall

I'm running emoncms 5 ... on ...Apache is V 2.2.21, PHP is V 5.3.10, MySQL is V 5.5.20) and Windows XP

 

I'm running emoncms 5 on Apache 2.2.22, PHP 5.4.14 and MySQL 5.6.11 on Windows 7 X64

And I'm using the MySQL with other software so I can't run an older version.

Automate's picture

Re: Can't create Input on new install of Windows

I made source code changes to allow emoncms to create inputs and feeds but now the web page will not display the feeds. In checking the SQL query log I see:

Query SELECT id,name,datatype,tag,time,value,public FROM feeds WHERE userid = 1
Query SELECT userid, public FROM feeds WHERE `id` = '0'
Query SELECT id FROM feeds WHERE `userid` = '1' AND `id` = '0'

The first query only returns records with id of 1 and 2 so I don't know why the second and third queries are looking for id='0'

Robert Wall's picture

Re: Can't create Input on new install of Windows

I'm still on an ageing 32-bit machine :-(   However...

I've just installed the latest WampServer (WampServer2.4-x86.exe  Apache 2.4.4, PHP 5.4.16, MySQL 5.6.12  )

and by simply transplanting the whole of the old MySQL data directory ( C:\Program Files\wamp\bin\mysql\[version]\data ) everything I've looked at so far works for me (recognised user, signed in, created inputs, feeds, visualisations on an old dashboard). It looks to me as if there is not an inherent fault in emonCMS.

So I am thinking there is a quirk in your 64-bit version of MySQL. I have read something about incompatibilities in MySQL with the 64-bit  Windows - I suggest you check along those lines.

[Edit]
"And I'm using the MySQL with other software so I can't run an older version."

A thought provoked by that: Did you install MySQL with WampServer or separately, i.e. is your MySQL where WampServer and emonCMS expect it, or is there a hard-coded path somewhere that means something is in the wrong place or being looked for in the wrong place?

Automate's picture

Re: Can't create Input on new install of Windows

emonCMS should not be dependent upon Wamp since since Wamp is for Windows only but the same emonCMS application will run on Linux or Windows.
 

One of the issues contributing to my problem is that Linux MySQL and Windows MySQL handle certain SQL query errors differently.  See the explanation in the first answer of this post http://stackoverflow.com/questions/3466872/why-cant-a-text-column-have-a-default-value-in-mysql

But either way the problem should be eliminated from emonCMS even if they are only causing warnings under Linux and maybe Win x86.

 

Robert Wall's picture

Re: Can't create Input on new install of Windows

Having read all of that thread you mention, it appears to me that there are some of the opinion that it's a MySQL bug. I'll suggest to Trystan that he takes a look at this thread.

Menen's picture

Re: Can't create Input on new install of Windows

Ubuntu12.04 - no active inputs

Automate's picture

Re: Can't create Input on new install of Windows

OK,  I finally figured out why my feed list was not displaying

My date.timezone value was not set in PHP.ini so any query with a time function was returning a warning like this.

"Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\emoncms\Modules\feed\feed_model.php on line 138"

This warning was messing up the parsing of the SQL query results

So now my inputs and feeds are working!

Automate's picture

Re: Can't create Input on new install of Windows

I have posted all the changes I had to make here

http://github.com/emoncms/emoncms/issues/87

For anyone else that has the same problems.

Menen's picture

Re: Can't create Input on new install of Windows

Earned example only: NanodeRF_multinode_bulksend

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.