That’s a bit of a loaded question. I guess something like the small script below would prove if PHP was able to connect to Redis on a basic level.
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
if ($redis->ping() === "+PONG") {
echo "Successfully connected to Redis!".PHP_EOL;
} else {
echo "Failed to get response from Redis!".PHP_EOL;
}
?>
Save the above code to a file called test_redis.php and run from the command line
pb66@test2:~$ php test_redis.php
Successfully connected to Redis!
Note this will also fail if Redis itself is not running or contactable, it assumes a localhost instance on port 6379. It may also pass if any Redis extension is installed and working if it has the same basic functionality, that might not mean it works fully with emoncms as we do not know if/what the differences are between extensions.
The earlier test (presumably using php -i
) that gave us the version number and reported the php “serialiser” was available, tells us that there is a redis extension enabled but that doesn’t confirm it was fully installed correctly, fully operational or fully compatible. It must be to a degree to report it’s enabled.
If it is fully installed correctly, fully operational or fully compatible, then it should not be throwing an error in emoncms. It would also throw the same error if Redis was not running or contactable, that’s why I asked for the confirmation of the “redis-server” service.
Making many unsupported assumptions leads me to think that the openSUSE php7-redis package is (most likely) phpredis repackaged just for that distro as it is not specifically listed at the phpredis repo. Therefore, maybe the PECL installer isn’t able to install to openSUSE or at least we do not know what the additional commands and paths might be, we know they differ for different Debian based distros but without knowing the architecture of openSUSE it’s anyone guess as to what might be needed.
Even if all the parts are present and correct, we do not yet know if 4.2.0 has any breaking changes, I suspect not, but we do not have any confirmed use with emoncms yet. If using PECL I would suggest rolling back to a known good version, I do not know if that is possible on openSUSE.
Also, what versions of PHP and Redis (server) are in play? There are reported issues with using emoncms with PHP 7.3. Most of us (I believe) are running PHP 7.0 and some running PHP 7.2 (PHP 7.1 was not widely released). As for Redis (server) I think 3.2.6 is the common “latest” (this is different to the redis extension version number).
For now, I’d say probably stick with the openSUSE version and check the test script above, the redis-server
service status and the various versions (perhaps post the server info from the admin page here).
Since openSUSE seems to have systemctl, you might also be able to enable “$allow_emonpi_admin” (or something to that effect) in settings.php, that should also show the redis-server status as well as the various version numbers, I have it enabled on a hosted Debian 9.0 VM without any issues.