我正在尝试使用PHP Resque(它通过redient使用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
我搞不清楚出了什么问题。请帮帮我!
错误转储的第一行显示了问题。
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!