Resque PHP(Redis 错误?)

发布于 2024-12-29 08:24:06 字数 865 浏览 2 评论 0原文

我正在尝试使用 PHP Resque (通过 redisent 使用 Redis),但我不断收到此消息错误:

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'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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紙鸢 2025-01-05 08:24:06

错误转储的第一行显示了问题。

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

fsockopen() 的第二个参数应该是端口号。不知何故,你正在向其中传递一个字符串。

接下来的其余错误只是由于连接失败造成的。

查看 Redisent.php 源代码 ,看来您必须将无效参数传递给 Redisent 对象的构造函数。

在源代码中,您有类似以下内容:

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

...确保第二个参数不是字符串。

以下是正确的:

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

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!
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文