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 :
RedisException
read error on connection
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
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:
Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
