phpredis with Redis to go

5.2k Views Asked by At

I got a problem similar to this one:

Connecting to Redis To Go with PHP

Basically, I have this uri in redis to go:

redis://myusername:[email protected]:9998

and I am trying to connect to it using phpredis:

$r->connect("redis://myusername:[email protected]:9998/");

And it's not working. In that other answer it is suggested to use predis, but I just don't want to. I should be free to use whatever client I want.

Any ideas?

Thanks in advance

2

There are 2 best solutions below

0
On

I have not used redistogo, but maybe you could try?

$r->connect('herring.redistogo.com', 9998);
$r->auth('myusername:foopassword');

0
On

Use this instead:

$r = new Redis();
$r->connect("herring.redistogo.com", 9998);
$r->auth("foopassword");

If that doesn't work, try $r->auth("myusername:foopassword") instead.

You can find the phpredis documentation on the official GitHub page.