By ahmadt
Hi
I’m using laravel 5.7 with phpredis (PHP 7.2), but I’m not able to get it to work with tls, I am trying to use it with digitalocean Redis managed database which only supports tls connections.
Any idea if tls even supported with laravel/phpredis?
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!
Accepted Answer
So I managed to get this to work, basically the current phpredis version that is shipped with php 7.2 (Ubuntu 18) is old and does not support tls, to fix this I had to update phpredis from pecl (https://pecl.php.net/package/redis)
Hello,
I’ve created a step by step guide on how to do that along with a short video demo for anyone who is experiencing the same issue:
Hope that this helps! Regards, Bobby
Error
Error while reading line from the server. [tls://private-XXX-do-user-XXX-0.b.db.ondigitalocean.com:25061]
Reason
DigitalOcean Managed Redis is not compatible with Predis.
Solution
Remove Predis and use phpredis. Phpredis is an extension for PHP.
# php -i | grep async_redis
async_redis => enabled
predis
from your composer.json
and add this line (good practice):"require": {
"php": "^8.0",
/* ... */
"ext-redis": "*",
/* ... */
.env
REDIS_CLIENT value:'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'default' => [
'scheme' => env('DATA_REDIS_SCHEME', 'tcp'),
'host' => env('DATA_REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
// 'read_write_timeout' => 0, // is not required for DO anymore, but just in case...
],
'cache' => [
],
],
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.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.