phpredis and AUTH

949 views
Skip to first unread message

Tobias

unread,
Jul 29, 2009, 8:54:26 PM7/29/09
to Redis DB
does somebody know if the phpredis ext. can send an AUTH?
couldnt figure it out yet...

thanks!
Message has been deleted

Gabriel Hedges

unread,
Jul 30, 2009, 2:15:15 AM7/30/09
to Redis DB
The PHP extension is a little deficient on command support, also while
I was coding with it - there may have been a weird memory leak as my
program continued to eat memory and never release it. Perhaps it was a
problem with my coding as I changed the structure of the program
around and also I switched to the imemcached-php client by gf - which
supports all current commands. You can get it @

http://imemcacheclient-php.googlecode.com/svn/trunk/Redis.class.php

Well and actually looking @ the code it doesn't support the auth
command, so here's how you can add it:

public function auth($password, $server="*") {

return $this->requestByServer($server,'AUTH ' . $password);

}

The class works like so:

$redis = new Redis();
$redis->addServer("127.0.0.1", 6379);
$redis->get("testkey");

etc...

If you paste in the auth function you can just squeeze:

$redis->auth("thepassword");

in before you start calling commands.


Note: Had to re-post this msg with corrected URL!

Tobias

unread,
Jul 30, 2009, 5:11:27 AM7/30/09
to Redis DB
about the memory problem with phpredis - i saw the same happening.
i tried to reset the connection/object with every push or pop - or
every 10k pops/pushes but it always ended up in a memory limit reached
error.
i really tried everything but after around 80k pops/pushes in a loop
it just breaks.

we're thinking about taking the extension, download the memcache ext.
source and merge them - with persistent hashes & redundancy over a
pool of redis servers etc.
guess that would be a great idea ;)

thanks so far for your help - im happy that at least my php/server/ram
is not broken and its actually that class ;)


-T

Tobias

unread,
Aug 4, 2009, 2:43:54 PM8/4/09
to Redis DB
something else that is funny with phpredis:
if the key doesnt exist and you do a get() it returns binary
garbage...

very helpful - you have to check every get() return if it is really
what you expect.


-T

Gabriel Hedges

unread,
Aug 5, 2009, 8:33:12 PM8/5/09
to Redis DB
Yeah I would definitely suggest not using the phpredis direct PHP
extension. I have not had any problems with leaks since I switched to
a extension written directly in PHP.

Gabriel Hedges

unread,
Aug 5, 2009, 8:33:58 PM8/5/09
to Redis DB
Sorry, not an extension, but the library mentioned above.
Reply all
Reply to author
Forward
0 new messages