Resque PHP(Redis 错误?)
我正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误转储的第一行显示了问题。
fsockopen() 的第二个参数应该是端口号。不知何故,你正在向其中传递一个字符串。
接下来的其余错误只是由于连接失败造成的。
查看 Redisent.php 源代码 ,看来您必须将无效参数传递给 Redisent 对象的构造函数。
在源代码中,您有类似以下内容:
...确保第二个参数不是字符串。
以下是正确的:
The very first line of your error dump shows the problem.
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:
...make sure the second parameter is not a string.
The following would be correct: