user1174824
user1174824

Reputation: 35

Resque PHP (Redis error?)

I'm trying to use PHP Resque (which uses Redis via redisent), but I keep getting this error:

Warning: fsockopen() expects parameter 2 to be long, string given in 
/home/***/public_html/codes/ao/resque/lib/Redisent/Redisent.php on line 56

Fatal error: Uncaught exception 'Exception' with message ' - ' in 
/home/***/public_html/codes/ao/resque/lib/Redisent/Redisent.php:58 Stack trace: #0 
/home/***/public_html/codes/ao/resque/lib/Redisent/Redisent.php(52): Redisent-
>establishConnection() #1 /home/***/public_html/codes/ao/resque/lib/Resque.php(38): 
Redisent->__construct('redis', '//***') #2 /home/***/public_html/cons/db.php(6): 
Resque::setBackend('redis://***...') #3 {main} thrown in 
/home/***/public_html/codes/ao/resque/lib/Redisent/Redisent.php on line 58

I can't figure out what's wrong. Please help me!

Upvotes: 2

Views: 2081

Answers (1)

Gabriel Bauman
Gabriel Bauman

Reputation: 2416

The very first line of your error dump shows the problem.

fsockopen() expects parameter 2 to be long, string given in 
  in /home/***/public_html/codes/ao/resque/lib/Redisent/Redisent.php on line 56

The second parameter of fsockopen() is supposed to be a port number. Somehow, you're passing a string into it.

The rest of the errors that follow are simply due to the failed connection.

In looking at the Redisent.php source code, it looks like you must be passing an invalid parameter to the constructor of your Redisent object.

In your source code, where you have something like:

$foo = new Redisent('hostname', '32323'); // See the bug?

...make sure the second parameter is not a string.

The following would be correct:

$foo = new Redisent('hostname', 32323); // no quotes around port number!

Upvotes: 3

Related Questions