MySQL has stopped accepting changes - can't create feeds etc.

After several months of success with emoncms on shared Linux hosting, I noticed one day that changes made to my feeds or other settings would not stay changed.  

For example, if I change the timezone, the next time I load the Account page the timezone reverts to the previous setting.  Most importantly, I can't create feeds or dashboards for any user!  I can't make existing feeds private or public- the icon will change for 1 sec or so but then will revert to the previous setting.

Oddly, I can register new users, that's the only thing "MySQL related" that works.

I can go into phpMyAdmin and change the time zone etc. manually, and that works.  But emoncms is no longer able to change the parameters.

Observation #2:  I needed to move to a different hosting account anyway, so I dowloaded the latest "EmonCMS for Shared Linux Hosting" ZIP file and installed 8.3.6 all over again in a new hosting account.  However, I have the same exact symptoms!

I've tried a zillion things with no luck.  Any ideas?

Thanks in advance,

 

Jeff

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

So the ISP got me a link to the error logs, and this is what I see over and over:

 

20141002T035650: www.mywebsite.com/index.php
PHP Notice:  Undefined index: write in /hermes/bosoraweb078/b163/ipw.mywebsite/public_html/emoncms/Modules/input/input_controller.php on line 22

PHP Warning:  Cannot modify header information - headers already sent by (output started at /hermes/bosoraweb078/b163/ipw.mywebsite/public_html/emoncms/Modules/input/input_controller.php:22) in /hermes/bosoraweb078/b163/ipw.mywebsite/public_html/emoncms/index.php on line 131

Bill Thomson's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

The "headers already sent" error message is usually caused by one of the following:

Whitespace before <?php or after ?>

UTF-8 Byte Order Mark

Previous error messages or notices

print, echo and other functions producing output (like var_dump)

Raw <html> areas before <?php code

 

Here's a link that'll help you find the problem, and how to fix it:

http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php

 

Regards,

Bill

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

Thanks Bill for the help!  Using your info I was able to fix the "headers already sent" error by replacing the error-ing files with new ones from the .zip.  I must have touched them and changed them in my quest for an answer to the "can't create feeds" problem.

 

However, that had no effect on the problem apparently!  I was able to look at the code in the web browser's debugger while making a feed, and here is what is failing while trying to make a new feed named "asdf":  

 

GET http://data.peakmonitor.com/input/set.json [HTTP/1.1 200 OK 3450ms]


Object { id: "2", nodeid: "6", name: "2", description: "asdf", processList: null, time: 1412303585, value: "94" } view:245
Array [  ] processlist.js:19


GET http://data.peakmonitor.com/feed/create.json  [HTTP/1.1 200 OK 608ms]

 

Do you see anything wrong with that request?

TrystanLea's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

Hello Jeff, do you mind if I create a user on http://data.peakmonitor.com and run some tests? you might want to turn user creation off afterwards in settings.php, as anyone can do so at the moment.

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

Hi Trystan,

 

Yes please!  I've run out of ideas and my hosting provider says that everything is fine (even though it isn't)... your input would be very valuable.

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

Is there a way that I can log errors created by JSON requests to mySQL?  My shared hosting doesn't have Log4PHP, and there are no errors in the CGI error log they provide.  

I'm still stuck with nothing working and no error messages.

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

I finally heard back from my ISP.  I had them look at their error logs while logging in and trying to change the timezone of my emoncms test user.  This is the error message they received:

PHP Notice: Trying to get property of non-object in /hermes/bosoraweb078/b163/ipw.mydomainname/public_html/emoncms/Modules/user/user_model.php on line 456

Here is what I see when looking in to user_model.php at lines 453-456:

453        $userid = intval($userid);
454        $result = $this->mysqli->query("SELECT timezone FROM users WHERE id = '$userid';");
455        $row = $result->fetch_object();
456        return intval($row->timezone);

Any ideas as to what this means?   

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

New development:  Bill Thompson suggested I try a different web host, so I installed emoncms (8.3.6) at a hosting account I have at GoDaddy.  And.... drumroll... it works!

 

I've re-installed emoncms on the original host (iPower.com) three times, using the same methods that worked at GoDaddy.  But I still cannot make changes or start feeds.  The error messages are all the same "Trying to get property of non-object" like this one:

20141007T003652: www.mydomainname.com/emoncms/index.php
PHP Notice:  Trying to get property of non-object in /hermes/bosoraweb078/b163/ipw.mydomainname/public_html/emoncms/Modules/user/user_model.php on line 456

And iPower tech support can reproduce the error, but blame emoncms.  They have given up.

Time to ask for a refund from iPower???  

It's odd because I had emoncms running in another hosting account at iPower for months without trouble.  Now that one is dead too, maybe they changed settings?

JD's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

Well, I am still down more than a week later.  I requested a refund iPower.com but they don't want to give me one, so I've fought with them a little more.  Does this bit from the emoncms LinuxInstall.md documentation apply to shared hosts?

+For `<Directory />` and `<Directory /var/www/>` change `AllowOverride None` to `AllowOverride All`. This may be on lines 7 and 11 of `/etc/apache2/sites-available/000-default`. Modern versions of Ubuntu store these in the main config file: `/etc/apache2/apache2.conf`.
+   
     $ sudo nano /etc/apache2/sites-available/000-default
+   
+or
+
+    $ sudo nano /etc/apache2/apache2.conf

-Change (line 7 and line 11), "AllowOverride None" to "AllowOverride All".
-That is the sections <Directory /> and <Directory /var/www/>.
[Ctrl + X ] then [Y] then [Enter] to Save and exit.

 

Robert Wall's picture

Re: MySQL has stopped accepting changes - can't create feeds etc.

It's highly likely that a shared hosting won't allow you access to Apache's config files. I think you'll have to find a way to achieve the same thing in .htaccess (either at your root level or at the directory level in question). While "AllowOverride" controls what .htaccess can do, you might be forever stuck; but it's likely the hosting provider will allow it to do what they perceive to be 'non-dangerous' things.

Comment viewing options

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