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

Medala's avatar
Level 12

Predis\Connection\ConnectionException No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]

I have my BROADCAST_DRIVER=pusher in env file, I can't find out why this event is trying to use redis. I get the same error even if I set BROADCAST_DRIVER=log!!!. This is the env for broadcasting:

BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120

Event: NotifyNewOrder

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class NotifyNewOrder implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    public $foo = 'bar';
    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('echoorder');
        //return new PrivateChannel('channel-name');
    }
}

the Route:

Route::get('/rdrdrd', 'OrderController@testnoti');

The Controller: OrderController

    {
        
        //NotifyNewOrder::dispatch();
        NotifyNewOrder::dispatch();
    }

Error:

Predis\Connection\ConnectionException
No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]
http://localhost:8000/rdrdrd

C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\AbstractConnection.php:155


    protected function onConnectionError($message, $code = null)

    {

        CommunicationException::handle(

            new ConnectionException($this, static::createExceptionMessage($message), $code)

        );

    }

0 likes
4 replies
neilstee's avatar

@medala have you tried clearing your config?

php artisan config:clear or php artisan config:cache

Medala's avatar
Level 12

Thanks, I ran php artisan config:clear or php artisan config:cache, Set BROADCAST_DRIVER to log and got the same error: Here is the log:

[2021-03-05 00:52:57] local.ERROR: No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379] {"exception":"[object] (Predis\Connection\ConnectionException(code: 10061): No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379] at C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\AbstractConnection.php:155)
[stacktrace]
#0 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\StreamConnection.php(128): Predis\Connection\AbstractConnection->onConnectionError('No connection c...', 10061)
#1 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\StreamConnection.php(178): Predis\Connection\StreamConnection->createStreamSocket(Object(Predis\Connection\Parameters), 'tcp://127.0.0.1...', 4)
#2 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\StreamConnection.php(100): Predis\Connection\StreamConnection->tcpStreamInitializer(Object(Predis\Connection\Parameters))
#3 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\AbstractConnection.php(81): Predis\Connection\StreamConnection->createResource()
#4 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\StreamConnection.php(258): Predis\Connection\AbstractConnection->connect()
#5 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\AbstractConnection.php(180): Predis\Connection\StreamConnection->connect()
#6 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\StreamConnection.php(288): Predis\Connection\AbstractConnection->getResource()
#7 C:\xampp\htdocs\kansupply\vendor\predis\predis\src\Connection\StreamConnection.php(394): Predis\Connection\StreamConnection->write('*6\
\
Medala's avatar
Medala
OP
Best Answer
Level 12

QUEUE_CONNECTION should be sync, fixed it

1 like

Please or to participate in this conversation.