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

trompx's avatar

Php artisan queue:listen throws "Call to undefined method Redis::transaction()" with phpredis

Hello everyone,

This is my first post so let me know if I can provide more info.

I use :

I have the following configuration :

In app.php

Providers
'App\MyProviders\PhpRedisServiceProvide'

Aliases
'PhpRedis'  => 'Illuminate\Support\Facades\Redis',

In queue.php

        'redis' => [
            'driver' => 'redis',
            'queue'  => 'default',
            'connection' => 'default',
            'expire' => 60,
        ],

In database.php

'redis' => [
        'cluster' => false,
        'default' => [
            'host'       => '192.168.33.100',
            'port'       => 6379,
            'prefix'     => '',
            'database'   => 0,
            'timeout'    => 0,
            'serializer' => 'igbinary',
            'persistent' => false
        ],

Jobs are pushed successfully in queues but when I try to start a queue, I get the following error :

$ php artisan queue:listen --queue=images --tries=3
PHP Fatal error:  Call to undefined method Redis::transaction() in /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php on line 179
[2015-08-31 20:04:49] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Redis::transaction()' in /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php:179 Stack trace: 
#0 {main}
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Redis::transaction()

The following code works :

$redis = PhpRedis::connection();
$redis->set('name', 'Dave');
$name = $redis->get('name');

Cache::forever('name', 'Dave');
$name = Cache::get('name');

Queue::push('MyService@test', array(
   'test'   => 'content'
), 'myqueue');

Thank you for the help.

0 likes
4 replies
pavelk's avatar
pavelk
Best Answer
Level 1

Laravel uses transaction wrapper of predis, which not implemented in "phpredis service provider"

Henry9162's avatar

Please does this means that I would have to switch to predis for this specific queue operation?, cos I'm already using phpredis to cache data and store sessions..can I use both phpredis and predis simultaneously for different operation??... I'm having exactly same issues here with laravel 5.3 were jobs are pushed to redisqueue but gives error class Redis not found when artisan queue:work is run.. I have already aliased redis to LRedis in config\app.php..

Please or to participate in this conversation.