I’m using PHP 7.2 and I’m unable to connect a Redis managed db instance.

in /etc/php/7.2/fpm/php.ini

session.save_handler = redis
; tried either :
session.save_path = "rediss://default:mypassword@db-redis-ams3-preprod-do-user-xxx-0.a.db.ondigitalocean.com:25061"
session.save_path = "tcp://default:mypassword@db-redis-ams3-preprod-do-user-xxx-0.a.db.ondigitalocean.com:25061"
session.save_path = "tls://default:mypassword@db-redis-ams3-preprod-do-user-xxx-0.a.db.ondigitalocean.com:25061"
session.save_path = "tls://db-redis-ams3-preprod-do-user-xxx-0.a.db.ondigitalocean.com:25061?auth=mypassword"

Each time same kind of issue :

read error on connection

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

I believe that the last line with TLS and auth defined looks correct.

I’ve just created a new Redis cluster and tested this with one of my servers where I have PHP 7.4 installed.

First I updated the PHP sessions handler:

; Old value:
;session.save_handler = files
; New value:
session.save_handler = redis

Then defined the save path:

session.save_path = "tls://redis_cluster_name.b.db.ondigitalocean.com:25061?auth=password"

After that, I restarted PHP-FPM or your Apache webserver.

Another thing that you need to keep in mind is that you need to open port 25061 for outgoing TCP connections in case that you have a firewall.

If this still does not work I could suggest trying with PHP 7.4 instead of PHP 7.2 and also make sure that you have the php-redis module installed.

For more information you could follow this tutorial here:



by Justin Ellingwood
Redis is an open source key-value cache and storage system, also referred to as a data structure server for its advanced support for several data types, such as hashes, lists, sets, and bitmaps, amongst others. It also supports clustering, making it useful in highly-available...