Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ricardogolez's avatar

Change Redis TCP to Unix Socket

does anyone know how to change redis config from TCP to Unix? my redis-cli on unix is working now. my only problem is how do I make it work with Laravel

0 likes
7 replies
Ricardogolez's avatar

I don't where to add my custom config for redis on cache. this is on config/cache.php

'redis' => [
    'driver' => 'redis',
    'connection' => 'default', <<< where can I find this default connection config?
],
jimmitjoo's avatar

I have a problem as well. A customer has a webhost that offers redis through a unix connection, but not tcp. Is there any way to make this working in Laravel without too much hassle?

jimmitjoo's avatar

And so I found out you just could add 'scheme' => 'unix' and 'path' => '/your/path' to the redis part of database.php.

2 likes
rip057's avatar

good info can be found here and here

https://github.com/predis/predis/wiki/Connection-Parameters

https://laravel.com/docs/8.x/redis

scheme [string - default: tcp]

Specifies the protocol used to communicate with an instance of Redis. Internally the client uses the connection class associated to the specified connection scheme. By default Predis supports tcp (TCP/IP), unix (UNIX domain sockets) or http (HTTP protocol through Webdis).

path [string - default: not set]

Path of the UNIX domain socket file used when connecting to Redis using UNIX domain sockets.

Please or to participate in this conversation.