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

michaelnguyen547's avatar

predis many issues

I am using Redis Labs for redis instance. It is a multi-az setup using AWS.

I often get Redis issues that can not be explained (caught by Sentry.io).

Predis\Connection\ConnectionException Error while writing bytes to the server.

Predis\Connection\ConnectionException Connection timed out

Redis Labs was very adamant that this has nothing to do with their servers. They can not find any evidence the server was down when the errors occurred.

With the help of Google, I've seen many Predis connection/writing bytes to the server issue. This is my config for redis

    'host' => env('REDIS_HOST_QUEUE', '127.0.0.1'),
    'password' => env('REDIS_PASSWORD_QUEUE', null),
    'port' => env('REDIS_PORT_QUEUE', 6379),
    'database' => 2,
    'persistent' => true,
    'read_write_timeout' => 60

I feel that 99% this has to do with predis library than the server itself. Any suggestions to fix these predis problems?

0 likes
2 replies
mjlovefl's avatar

Why not try using the Redis PHP extension instead?

Not sure what OS or PHP version you are running, but generally it's as easy as "apt install php-redis" and then in your cache config, set the redis driver from predis to redis.

'redis' => [
    'driver' => 'redis',
    'connection' => 'default',
],
michaelnguyen547's avatar

I'm using FortRabbit to host my app. I am asking them if they support phpredis

Please or to participate in this conversation.