Updating system libraries used by emoncms

Are you referencing the capital “M”? If so no, the name is converted to all lower case so even sudo pecl upgrade mOSQUITTO should work.

1 Like

Nice, this did the trick I’m now running 0.4 :+1: . I’ll report back any issues

On a separate topic I see there are updates available for dio and redis. We can start a new topic to discuss these if you think they are worth updating. What version are you running? Have you successfully been running a newer version?

In fact all this discussion regarding Mosquitto update should be moved to a different topic since it’s not direclty related to Stretch.

pecl.php.net Available Upgrades (stable):
=========================================
Channel      Package Local          Remote         Size
pecl.php.net dio     0.0.6 (beta)   0.1.0 (beta)   37kB
pecl.php.net redis   2.2.5 (stable) 3.1.6 (stable) 196kB
1 Like

I’m currently running;

dio v0.1.0 (@pb66 suggests that this is no longer needed)
redis v3.1.1

…on Stretch

Paul

1 Like

Is everybody in agreement that we remove the dio module from the installation guide?

Paul

I can confirm that this is the version installed.

1 Like

Yeah, by the time I had written the post, the proceeding thread had disappeared leaving it making no sense, I was out of time and had to go out so I just deleted it until things settled.

No not at all, I would have edited it to make sense, but if I do that now it will leave these posts hanging so I will just copy the content here so it is searchable text not an image (also so I can edit my typo on the version I was running for some months, v3.1.4 not v3.1.6, that is what I have now upgraded to).

So what I posted was…

Regards the redis extension, we have discussed that in some depth elsewhere, but using the install guide will fetch the latest version, only the emonSD image needs further discussion as there are 3 install methods used on that image and it has historically been fixed at v2.2.8.

I have been using redis v3.1.4 for several months without an issue and now upgraded to 3.1.6 without any obvious issues yet, however I am using php7 on Stretch not am emonSD image so it needs testing for php5.

As for the dio module… Why is it still in the guide??? I have brought this up before, more than once. We have not used the dio module since the emoncms “rfm2pi” module and the php script for the rfm2pi, before oemgateway and emonhub, it maybe 4 years since it has been used and as the serial port is used exclusively by emonhub (when installed) installing the dio module only adds the possibility of a user running a non-standard php script that interferes with the serial port and emonhub. I stopped including it in any of my SD card images or personal install scripts/guides way before the emonpi was launched.

While we are at it…

Can we please start installing the extensions using the provided mechanism rather than manually creating multiple text files?

all the OEM guides say to add 2 links for each extension/module in the apache2/conf.d and cli/conf.d folders under either etc/php5 or etc/php/7.0 depending on which version of php you are using. eg

sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/apache2/conf.d/20-redis.ini'
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/cli/conf.d/20-redis.ini'

This is not in keeping with the intended methods, there should be only one text file written to the mods-available directory eg

echo 'extension=redis.so' > /etc/php/7.0/mods-available/redis.ini

and then the extension can be enabled with phpenmod redis or disabled with phpdismod redis eg

pb66@test2:~$ sudo phpenmod redis
pb66@test2:~$ ls -la /etc/php/7.0/*/conf.d/*redis.ini
lrwxrwxrwx 1 root root 37 Oct 27 12:54 /etc/php/7.0/apache2/conf.d/20-redis.ini -> /etc/php/7.0/mods-available/redis.ini
lrwxrwxrwx 1 root root 37 Oct 27 12:54 /etc/php/7.0/cli/conf.d/20-redis.ini -> /etc/php/7.0/mods-available/redis.ini

and

pb66@test2:~$ sudo phpdismod redis
pb66@test2:~$ ls -la /etc/php/7.0/*/conf.d/*redis.ini
ls: cannot access '/etc/php/7.0/*/conf.d/*redis.ini': No such file or directory

So instead of (for example)

for php5

sudo sh -c 'echo "extension=redis.so" > /etc/php5/apache2/conf.d/20-redis.ini'
sudo sh -c 'echo "extension=redis.so" > /etc/php5/cli/conf.d/20-redis.ini'

or for php 7.0

sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/apache2/conf.d/20-redis.ini'
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/cli/conf.d/20-redis.ini'

we would have

for php5

sudo sh -c 'echo "extension=redis.so" > /etc/php5/mods-available/redis.ini'
sudo php5enmod redis

or for php 7.0

sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/mods-available/redis.ini'
sudo phpenmod redis

or better still, since using echo for this purpose is frowned upon in many circles (since it behaves differently in various shell’s) and initiating another shell within a shell is messy (sudo sh -c) we should probably be using

for php5

printf "extension=redis.so" | sudo tee /etc/php5/mods-available/redis.ini 1>&2
sudo php5enmod redis

or for php 7.0

printf "extension=redis.so" | sudo tee /etc/php/7.0/mods-available/redis.ini 1>&2
sudo phpenmod redis

I have been using these methods for a long time now without any issue.

4 Likes

Should we still be mentioning php5 when the current installation guide is for Stretch, which specifies php7.0?
Users should be building systems from current standards, not archives.

Paul, please feel free to update the current build guide.

Paul

I’d go further than this and suggest a script that took out the guesswork, checked for PHP versions and created the right links.

Am I right in thinking that this is also better a better method if you are using a stack that is not Apache? i.e. works for all stacks?

Could also have a small script for the MQTT libraries as well.

I’d suggest, it may well be easier to maintain a script, than keeping the install guides correct. This may well get more of a chore as the Stretch v Jessie questions arise as folk start to migrate.

All I’d ask is that the script’s commands run at the same level the script is run at. I tend to use DietPi which has a root login as default so scripts with a liberal sprinkling of ‘sudo’ are a pest!

Summarizing the suggested changes so far (so they don’t get forgotten/overlooked!)

  1. Remove dio installation from build guide
  2. Change the way in which redis is referenced
  3. Change the way in which Mosquitto is referenced
  4. Consider the development of a install script
  5. Consider changing the way in which Mosquitto is specified - discussed, and agreed that Mosquitto-alpha should continue to be specified in the build guide.

Paul

Can we add “Update the method the Mosquitto libraries are referenced”. Looks to me this is the same issue.

Also, “Changing the mosquitto library” as that was where this thread started :smile:

I was thinking of an install script rather than an update script as updating is likely to be a little more fraught!

I thought the decisions was that the current Mosquitto command pulled the latest version anyway - so no need to change. Or have I mis-read.

Paul

I wasn’t sure if that was more by luck than judgement. Be worth adding in as a positive ‘leave it alone’ rather than implied (just for the record as it were).

Well how about changing;
sudo pecl install Mosquitto-alpha
to
sudo pecl install Mosquitto
…and let PECL decide the version?

Any thoughts @pb66 Paul & @glyn.hudson .

Paul

Unfortunately that won’t work

Good question, I would say not IF the guide was truly a “Stretch” guide rather than a “Raspberry Pi 3 Raspbian Stretch for emonBases only” guide, by that I mean it should not exist in a Raspberry Pi folder, it should not reference the Pi user or user folder and there should be no mention of any thing to do with the serial port or the config.txt etc, after all there is actually no connection between emoncms (which is the topic of the guide) and the serial port configuration, that should be in a separate emonhub guide, linked from here. I would guess that oncw you remove the pre-built emonSD users, there are possibly less users installing emonHub or to a device with a serial port than not.

There really is no reason this same guide (or potentially, script) couldn’t be used for Debian, Ubuntu or probably even DietPi too, hopefully any Debian9 (aka Stretch) based distro, even shared hosting if commented well. Plus clearly separating the LAMP section from the install emoncms section (probably within the same guide) would also provide an easier guide for users to follow even when installing emoncms alongside an existing setup.

Yes, I’ve updated the install guides:

I’m assuming you mean v2.2.7? Here is the current emonSD build guide setups:

Note: at time of writing the version of php5-redis included in the Raspbian Jessie sources (2.2.5-1) caused Apache to crash (segmentation errors in Apache error log). Installing the latest stable version (2.2.7) of php5-redis from github fixed the issue. This step probably won’t be required in the future when the updated version of php5-redis makes it’s way into the sources. The check the version in the sources: sudo apt-cache show php5-redis

git clone --branch 2.2.7 https://github.com/phpredis/phpredis
cd phpredis
(check the version we are about to install:)
​cat php_redis.h | grep VERSION
phpize
./configure
sudo make
sudo make install

Is there any change log for php-reds? What is the current recommended stable version? I’m happy to test newer versions and consider updating emonSD if there are any relevant fixes.

This is a good idea. I will change ‘alpha’ > ‘beta’ in in the emonSD build guide. I would prefer to use as stable versions as possible.

That commit also removes installing the swiftmailer module and that’s the “linux install guide” which isn’t the current mainstream guide,

it needs changing at emoncms/docs/RaspberryPi at master · emoncms/emoncms · GitHub [edit - removed as @glyn.hudson did this whilst I was writing]

and possibly at emoncms/jessie.md at master · emoncms/emoncms · GitHub too.

I have also noticed that the emonSD build guide in the emonPi/docs folder points to the stretch version not the jessie version since, most likely because the emoncms/docs/raspberrypi/readme.md got switched out from jessie to stretch, that needs editing to point to the jessie guide.

Where is this? Please link to the relevant line. I can’t see reference to Stretch in the emonSD build guide

Can you remember which old thread discussed upgrading php-redis? I’ll give it a go and setup a test.