PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, April 19, 2022

[FIXED] How to Resolve Predis Connection Timeout

 April 19, 2022     laravel, phpredis, predis, redis     No comments   

Issue

i'm using predis integrated with laravel, in some case predis got connection timeout, but when i'm trying to connect redis server via cli, i got connected perfectly

can anyone help me how to resolve it ?

Predis\Connection\ConnectionException {#7222-connection: Predis\Connection\StreamConnection {#7171
-resource: null
-cachedId: null
#parameters: Predis\Connection\Parameters {#7178
  -parameters: array:5 [
    "host" => "Host"
    "password" => "Password"
    "port" => "6379"
    "database" => 0
    "scheme" => "tcp"
  ]
}
#initCommands: array:1 [
  0 => Predis\Command\RawCommand {#7218
    -slot: null
    -commandID: "SELECT"
    -arguments: array:1 [
      0 => 0
    ]
  }
]}#message: "Connection timed out [tcp://Host:6379]" #code: 110 #file:"./vendor/predis/predis/src/Connection/AbstractConnection.php" #line: 155

Any help will be greatly appreciated!


Solution

As you can see in the debug data your Host is set to Host. I'm assuming you got redis on a localhost setup, in your .env file set the following variable. Also your password seems off, adjust that also, most local redis installs has a blank password.

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=

If you got redis on a server, set your ip accordingly.



Answered By - mrhn
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing