'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

Hello,

It seems the introduction of basic logging is causing an issue which prevents rfm12piphp from starting:

PHP Fatal error:  Class 'EmonLogger' not found in /var/www/emoncms/Modules/user/user_model.php on line 34

EmonLogger.php is already included in index.php; by including EmonLogger in user_model and process_model (with an explicit path) it can be made to work. Not sure if that suggests a path issue - I've never done any PHP. The easier thing to is to remark out references to EmonLogger but either way it creates a git conflict which makes updating a pain.

Any ideas?

Cheers,

 

Andy

pb66's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

This issue may relate to some changes made to the raspberrypi module and then only partially removed, see the last ~10 posts on http://openenergymonitor.org/emon/node/4908. it looks like those changes have now been fully reverted this evening, so if you last updated from git before this try updating emoncms and raspberrypi module from git again.

If you still have an issue you could try the instruction in that thread git checkout 8.0.9 purely as a diagnosis check and post back your results along with what you updated and when etc.

Did the install previously work or is it a fresh install?

Paul

Schism's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

Of course, I completely missed the fact that the rfm12piphp script uses the same files as emoncms but is a separate process... urgh

There should be a simple fix for this within the raspberrypi module, I'll make a pull request presently.

Schism's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

OK - see https://github.com/emoncms/raspberrypi/pull/42/files

It would be good to confirm that someone can make that change manually and it works for them too?

The logging won't work while running the rfm12piphp script (there's no log configuration going on) but it should now be silently bypassed, which was the aim.

Schism's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

Thanks to @Bra1nK, we've got confirmation that that fix works for APT-based installs. I'll update the APT repository as soon as the pull request is accepted and the module gets a new version tag.

andy_l's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

Many thanks for this. I have made the change manually to test - all working ok.

Cheers,

 

Andy

Schism's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

No worries. Unfortunately the exact same thing happened to me as to everyone else - I made the changes, checked everything was running OK, but of course I hadn't restarted rfm12piphp on that box... doh!

ngbod's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

I've just tried to update via git from v7 image to v 8.1.1 and am still unable to get the rfm12piphp service running.....

pi@raspberrypi ~ $ sudo service rfm12piphp start log
Log is turned on
Starting RPI
pi@raspberrypi ~ $ PHP Notice:  Use of undefined constant _ENABLE_PASSWORD_RESET_ - assumed '_ENABLE_PASSWORD_RESET_' in /var/www/emoncms/settings.php on line 51
PHP Fatal error:  Class 'EmonLogger' not found in /var/www/emoncms/Modules/user/user_model.php on line 34

I tried yesterday to update via apt to v8.0.9 but although the rfm12piphp service ran other things such as node module and replication would not work. I think v 8.0.8 was the newest Working git version I have tried, but how would I update a v7 image to v8.0.8 via git?

ngbod's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

Thanks Dave, this mod seems have fixed my git install.  https://github.com/emoncms/raspberrypi/pull/42/files

I still get the (unrelated) password reset error but that doesn't seem to cause any problems.....

pi@raspberrypi ~ $ sudo service rfm12piphp stop
Log is turned off
Stopping RPI: stopped
pi@raspberrypi ~ $ sudo service rfm12piphp start log
Log is turned on
Starting RPI
pi@raspberrypi ~ $ PHP Notice:  Use of undefined constant _ENABLE_PASSWORD_RESET_ - assumed '_ENABLE_PASSWORD_RESET_' in /var/www/emoncms/settings.php on line 51
sudo service rfm12piphp status
Log is turned off
running
pi@raspberrypi ~ $

Schism's picture

Re: 'PHP Fatal error: Class EmonLogger not found' when starting rfm12piphp

That setting should be either true or false, depending on what you want to do. Probably the docs need to be updated to make that clear, when replacing the other placeholder fields (DB credentials etc).

Comment viewing options

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