Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPRedis getClient only for v6+ #59

Open
inpresif opened this issue Feb 17, 2023 · 2 comments
Open

PHPRedis getClient only for v6+ #59

inpresif opened this issue Feb 17, 2023 · 2 comments

Comments

@inpresif
Copy link

Unfortunately, as a windows user for local dev there's no such version yet (5.3 or so is highest).

This means that the line:
$client = $clientFacade->getClient(new \Redis(['host', 6379])); will not work, as the construct expects 0 values.

Tried this:

$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$client = $clientFacade->getClient(new Redis($redis));

but that resolves to an error:

<br />
<b>Fatal error</b>:  Uncaught RedisException: Redis server went away in C:\Users\test.dev\redis\redisearch-macfja\vendor\macfja\redisearch\src\Redis\Client\PhpredisClient.php:53
Stack trace:
#0 C:\Users\test.dev\redis\redisearch-macfja\vendor\macfja\redisearch\src\Redis\Client\PhpredisClient.php(53): Redis-&gt;getOption(8)
#1 C:\Users\test.dev\redis\redisearch-macfja\vendor\macfja\redisearch\src\IndexBuilder.php(228): MacFJA\RediSearch\Redis\Client\PhpredisClient-&gt;execute(Object(MacFJA\RediSearch\Redis\Command\Create))
#2 C:\Users\test.dev\redis\redisearch-macfja\index.php(32): MacFJA\RediSearch\IndexBuilder-&gt;create(Object(MacFJA\RediSearch\Redis\Client\PhpredisClient))
#3 {main}
  thrown in <b>C:\Users\test.dev\redis\redisearch-macfja\vendor\macfja\redisearch\src\Redis\Client\PhpredisClient.php</b> on line <b>53</b><br />

Any tips?

@MacFJA
Copy link
Owner

MacFJA commented Feb 18, 2023

I didn't try it, but you should be able to just give the $redis of your example instead of wrapping it into a new Redis client:

$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
// And any other commands needed to initialize the Redis client
// Like auth, setOption
$client = $clientFacade->getClient($redis);

@inpresif
Copy link
Author

Thanks for the answer I appreciate that.
I'll have a go at that, not sure if I tested that already.

Yesterday, I did install PRedis as well just to get ahead, then I realized redisearch is not supported for Windows either, so we're off to another issue to fix (probably Docker or in the worst case, develop on the server instead of locally).

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants