Php-Redis 3.1.1?

Sorry to disappear “mid discussion” Monday, I had a 5am start yesterday morning and then didn’t finish until late.

Latest apt-get version last I checked was still v2.2.5 so that method of update isn’t much use, I would however also be concerned about that using that method even if the package did get updated for Jessie as there could be an unexpected outcome since it still thinks it’s running v2.2.5 on the emonSD. If you run sudo apt-cache show php5-redis even after having cloned v2.2.7 it still says v2.2.5,

Installing by apt-get was the best method until v2.2.5 fell behind, now PECL is better as you can specify any version just by using (for example) “redis-v2.2.8” in place of just “redis”. But I took the plunge and installed v3.1.0 on my live server some months ago and I have not noticed any issues, I upgraded to v3.1.1 at some point too.

Updating via PECL is just as easy as it is via apt-get, I would have to check my notes for the exact syntax, but is is something as easy as pecl update redis or words to that effect.

The current emonSD might get a bit messy to uninstall both the apt-get package and the cloned files and reinstall using PECL but I’m sure it’s possible (unless someone beats me to it, I will try it on and emonPi at some point, although I cannot say when that might be right now)

Unless the debian package gets updated I would recommend using the PECL installer alone on the next image and even if Debian does get updated to a version less than v3.1.1 it might be worth sticking with PECL to avoid having to choose the correct one for php5 or php7.

Installation via PECL should be as easy as (I’ve included the apt-get lines just to add clarity)

sudo apt-get php-pear php5-dev
sudo pecl install redis
sudo sh -c 'echo "extension=redis.so" > /etc/php5/mods-available/redis.ini`
sudo php5enmod redis

for php5 or
for php7 something like

sudo apt-get php-pear php7.0-dev
sudo pecl install redis
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/mods-available/redis.ini'
sudo phpenmod redis

or

sudo apt-get php-pear
sudo pecl install redis
sudo sh -c 'echo "extension=redis.so" > /etc/php/7.0/mods-available/redis.ini'
sudo ln -s  /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/apache2/conf.d/20-redis.ini
sudo ln -s  /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/cli/conf.d/20-redis.ini

The php7 suggestions are untested by me as I’m not running php7 but there seems to be some confusion over using “phpenmod” to create the “module enabling” symlinks in php7, it definitely works in php5 as that’s what I always use.

I have just reread the install guide for emonSD and was surprised to find the php redis module is actually installed 3 rimes (not 2) by 3 different methods!!! Firstly php5-redis is included in the apt-get packages, then that is “cloned over” direct from the GitHub repo to get v2.2.7, but then “redis” is still included in the PECL install following that! Since there is no version specified it would depend when the command is run as to which version you will get, so as the emonPi image was recompiled in Nov it may already be running a later version than v2.2.7 (it would depend if the order of events in the install guide was adhered to as well).

To get the Debian package version use

sudo apt-cache show php5-redis

should report “Version: 2.2.5-1”

then to get the PECL version use

pecl info redis

To see what version is actually in being used create a file called info.php in /var/www/html containing

<?php phpinfo(); ?>

and navigate to http://emonpi/info.php in a browser and scroll down to the redis section, that should be the loaded version.

To check for an upgrade via PEAR/PECL use

 pear list-upgrades

if there is a later version available it can be installed using

sudo pecl upgrade redis

After any upgrade of php redis you must restart the server with

sudo service apache2 restart

Just tried updating my test emonPi using the PECL method and emoncms still runs, it reports v3.1.1 via “info.php” but I do not have any feeds currently setup to say if it is fully functional. I do wonder what would happen if there was a bugfix in the Debian php5-redis v2.2.5 package and an apt-get update/upgrade of Raspian was run. so I think the emonSD image needs tidying, perhaps remove the php5-redis module using sudo apt-get purge php5-redis and delete the phpredis repo before upgrading (or reinstalling?) via PECL ? I have no idea if that would 100% definitely clean up all the loose ends though.

In the guides this small piece

sudo pear channel-discover pear.swiftmailer.org
sudo pecl install channel://pecl.php.net/dio-0.0.6 redis swift/swift

is as old as the hill’s and has little or no accompanying info, I recommend dispersing it into 2 parts (dio is no longer needed), one for email if wanted or required

sudo pear channel-discover pear.swiftmailer.org
sudo pecl install swift/swift

and include the sudo pecl install redis etc with the “installing redis” sections of each of the alternative php5 or php7 guides since it is not needed if redis is not being installed and differs depending on whether php5 ot php7 is used.

I can take a look at updating the guide(s) if you like but I’m not realy sure what is planned with the emoncms install stuff, is it being included in the “new documentation”? I would hate to invest in rewriting something heading for deletion.

1 Like