Questions about the EmonCMS installation procedure (Linux)

Hi all,

I had difficulties in installing EmonCMS on a linux platform( Ubuntu Desktop 12.04 LTS).

I have some question about the procedure I followed

 

1. What should I do first :

a) Install the redis server and then follow the steps 1) to 7) described below

or

b) Follow the steps 1) to 7) and then install the redis server

 

 

2. When editing the file settings.php (stp 6), I guess that I must not enter

$username = "USERNAME";
$password = "PASSWORD";

but

$username = "root";
$password = "the root password of the mysql database";

Am I right ?

 

 

3. How to install an EmonCMS module, like the event module ?

I'm not familiar with git but I guess I can do :

cd /var/www/emoncms/modules

git clone https://github.com/emoncms/event.git

Nothing else to do ?

 

 

Thank's all for your reply.

Happy new year !

Eric

Paul Reed's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi Eric

1. What should I do first :

I would complete steps 1 - 7, and then install/config redis. I've just updated my system, and added redis last of all, and it worked fine for me.

2. When editing the file settings.php (stp 6), I guess that I must not enter:

You are correct, add your actual MYSQL login details.

3. How to install an EmonCMS module, like the event module ?

Again you are correct, just make sure that you perform the git clone from within the Modules directory, and also check if any of the additional modules require other libraries, such as php5-curl for the event module.

 

Paul

Eric_AMANN's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Thank's for your help Paul !

 

Eric_AMANN's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi,

I am still having some trouble installing EmonCMS 7 on Linux.

I followed the steps 1.) to 7.) then I installed redis as Paul suggested. For redis, note that I had to enter "sudo apt-get install php-pear" to get pecl working. (missing point in the installation procedure ?)

The first time I went to web emoncms interface, I got the following error message : "Can't connect to redis database, phpredis is not installed, see readme for redis installation". I solved this issue by rebooting my machine ...

After rebooting, I created the first Emoncms user.
Then I went to the admin part and I tried to click on the "Update and check" button. I got the following error message :
"Fatal error: Call to a member function fetch_object() on a non-object in /var/www/emoncms/Modules/admin/update_class.php on line 64"

Could you tell me what's wrong ?

Eric

AllenConquest's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi,

I am installing emonCMS on OSX Mavericks, but the problem I'm having is that gettext() is not installed as part of PHP on the Mac. Eric, did you have any problem with this?

Allen

AllenConquest's picture

Re: Questions about the EmonCMS installation procedure (Linux)

I got it working and am putting my solution here to help anyone else with this problem. I followed these steps:

  • Download your version of PHP (mine was 5.4.17)
  • cd ~/Downloads/php-5.4.17/ext/gettext
  • phpize
  • ./configure --with-gettext=/opt/local
  • make
  • cd modules
  • sudo cp gettext.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
  • sudo apachectl graceful

 

Eric_AMANN's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi,

I am glad you solved this issue with gettext() on Mac. I didn't get it on Linux.

Now, have you got a fatal error when clicking on the "Update and check" button in the admin part ?

Thank's all for helping me.

Eric

 

AllenConquest's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi Eric,

I was getting an error, but that seems to have gone away now. It wasn't exactly the same as yours though. I had to manually add the new 'record' column to the inputs database table, as shown in this post http://openenergymonitor.org/emon/node/3250.

I'm also trying to backup my emoncms.org data to my new local installation using the import_inputs.php and import_full.php scripts. But I'm getting errors with these. Do you have any experience of using them?

Thanks,

Allen

Eric_AMANN's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi,

Thank's Allen for your support. It seems to work !

In mysql, I put "use emoncms" and then  "ALTER TABLE `input` ADD `record` tinyint (1) DEFAULT 0;"

Now, I get the following message when clicking on "Update and check" button : "Database is up to date - Nothing to do"

Need to be fixed or noticed in the installation procedure ?

 

Regarding the import scripts (you should create a separate thread for this point)

When using the input import script, I did not encountered any problem to import my inputs from emoncms.org to my local emoncms server. I just got the following message for each input imported : PHP Notice:  Undefined property: stdClass::$record in /var/www/emoncms/usefulscripts/replication/import_inputs.php2 on line 16

When using the full import script, I managed to import all my feeds. I can see all of them in mysql (select * from feeds) but I can see only one of them in the emoncms web interface using the admin account. Same result using JSON :  "http://localhost/emoncms/feed/list.json" give me only one feed.

[Edit : I deleted this lonely feed in the emoncms interface and then all of them suddenly  appeared !]

Regards,

 

 

 

AllenConquest's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi Eric,

It sounds like we are experiencing the same problems, which is sort of reassuring in a strange way! 

I am also getting the same error in import_inputs.php, which I believe is because the code is trying to import a field called 'record' into the new database column that you (and I) manually added. However, there is no 'record' value in the JSON feed!

I am also seeing exactly the same behaviour with the feeds, i.e. all of them seem to be imported in the database, but I'm only getting the first one displayed on website and in the JSON feed. I'm not been able to debug this issue fully.

I was hoping someone with more experience of the code would jump in and tell me I was doing some wrong.

I'll have another look this evening at the code and see if I can work out exactly what is going wrong.

Cheers,

Allen

Eric_AMANN's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Sorry Allen for editing my post so fast several time, I made a mistake.

If you want to have a look on the code note that when I sometime got the following error message :

Notice: Undefined variable: feedclass in /var/www/emoncms/usefulscripts/replication/import_full.php on line 50
PHP Fatal error:  Call to a member function load_feed_to_redis() on a non-object in /var/www/emoncms/usefulscripts/replication/import_full.php on line 50

Fatal error: Call to a member function load_feed_to_redis() on a non-object in /var/www/emoncms/usefulscripts/replication/import_full.php on line 50

 

I had to launch the cript several to make it work until the end.

Now, all feeds appeared in my local server but data seem not be imported as raw data visualization are blank for every feeds...

 

Bellow is what I get when importing feeds

feed exists 24xxx
Downloading: r:24xxx to l:24xxx xxxxxxxxxx
--layer: 0 0 bytes
--layer: 1 0 bytes
--layer: 2 0 bytes
--layer: 3 0 bytes
--layer: 4 0 bytes
--layer: 5 0 bytes
feed exists 24xxx
Downloading: r:24xxx to l:24xxx xxxxxxxxxx
--layer: 0 0 bytes
--layer: 1 0 bytes
--layer: 2 0 bytes
--layer: 3 0 bytes
--layer: 4 0 bytes
--layer: 5 0 bytes

AllenConquest's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Yes, I had the feedclass error as well. This is because the $feedclass object is created in the main part of the code, but not passed into the import_timestore() function. I think this would work for some people, depending on their PHP settings (or PHP version).

So I modified the import_timestore() function on line 35 to:

function import_timestore($mysqli,$userid,$server,$apikey,$feed,$feedclass)

and then updated the code that calls this on line 30 to:

if ($feed->datatype==1 && $feed->engine==1) import_timestore($mysqli,$userid,$server,$apikey,$feed,$feedclass);

I think this would be a useful change to the source, but I'm not sure of the procedure for getting these sort of things updated.

AllenConquest's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Hi Eric,

Some success!

I had a feeling it was to do with redis. So I investigated the redis-cli command. It appears that only the first feed was registered in redis with the user. You enter the redis command line by typing redis-cli from a terminal window. Once in the command line type the command:

key *

This gives a list of all the keys in redis. You should have one that looks like "user:feeds:1". Then type:

sMember user:feeds:1

That listed just the first feed that was showing in the JSON feed.

I probably could have just deleted the user:feeds:1 key and just loaded the website up again to fix it. But I ended up deleting all the keys and basically emptying redis using the "flushall" command.

I also emptied the MySQL database input and feeds tables.

I then re-ran both the inport_inputs.php and import_full.php

I now have all the feeds showing on the website with all their data.

I hope this makes sense and helps.

Eric_AMANN's picture

Re: Questions about the EmonCMS installation procedure (Linux)

Thank you and congratulations Allen !

Your modification in the import_full. script solved the problem for me too.

I can't figure out why anyone else didn't face this issue in the past...

 

After importing the feeds on my local server, I faced a second but known issue.

I wasn't able to visualize my feeds because my timestore data was corrupted.

To get my data usable, I had to modify the import_full script as explained by threldor ( fwrite($backup,$data);=> fwrite($backup,$data,268); )

 

It would great to update the import_full script in git to solve this two issues.

Could somebody do it or tell me how to do it ?

 

Comment viewing options

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