Php-redis not recognised by php [solved]

I was getting the following error message in emoncms:

Process 'process__kwh_to_power' not available. Redis not installed.

But redis is installed:

redis-server/stable,now 5:5.0.3-4+deb10u1
php-redis/stable,now 4.2.0-1

And redis-cli --stat and redis-cli --bigkeys produce reasonable output.

I saw that redis was disabled in /var/www/emoncms/settings.php, but if I enable it, I get

**Fatal error** : Uncaught Error: Class 'Redis' not found in /var/www/emoncms/index.php:34 Stack trace: #0 {main} thrown in **/var/www/emoncms/index.php** on line **34**

I therefore assume that php is not finding php-redis.

Any clues how to fix this?

Hi Jeff, what is your system? emonPi or self install? Has it ever worked? if so, what has changed, an update to PHP for instance?

This is my goto thread on redis - there are actually 3 components installed and enabled. Beware, the install has changed since that thread!!!

You can see how REDIS is currently installed here EmonScripts/ at master · openenergymonitor/EmonScripts · GitHub

Thanks for the swift reply. It is a self-install, which did work but probably not since I upgraded to Buster, or possibly, since a PHP upgrade.

I assume the reason for the problem is that emoncms is using php7.0, and the php-redis package in Buster only supports php7.3:

I don’t like installing software past the package manager. I’ll have a go at creating a .deb with php7.0 support.

Or can I upgrade emoncms to php7.3?

If you look at the EmonScripts docs it supports an install on Debian.

Probably the phpenmod is not correct.

No it now uses 7.3 IIRC.

My machine has missed an update, then, as emoncms/admin/view shows:



7.0.33-0+deb9u3 (Zend Version 3.0.0)

How do I get emoncms to use php7.3?

No, PHP is not updated as part of the emonCMS updates - it tends to break things. The new scripts take account of the PHP version installed when configuring it for emonCMS.

The chances are upgrading to Buster in-situ probably broke the install. Do you still have 7.0 and 7.3 installed?

Yup. In parallel. Just removed all the php7.0 packages, installed libapache2-mod-php7.3, and emoncms suddenly is running with php7.3 :slight_smile:

And after enabling redis in settings.php, things are working! Thanks!

1 Like

I had same problem after an apt upgrade on buster.
After checking /etc/php7.3/mods-available I found out, that redis.ini is missing, even php-redis is installed.
On the opposite, everything looks fine in /etc/php7.4.

In apt history I can see redis-server and php-redis were updated together with many others php- packages.

So, I decided to switch from php7.3 to php7.4 for a try, and unloaded libapache2-mod-php7.3, then loaded libapache2-mod-php7.4.

Now everything looks fine :slight_smile: Later will uninstall php7.3 probably