2

I am trying to get this package https://github.com/nrk/predis-async and the instructions says to do: composer require predis/predis-async. I tried downloading the options phpiredis extension but when I run composer it says:

 Problem 1
   - predis/predis-async v0.2.3 require ext-phireids * -> the requested PHP extension phpiredis is missing from your system

Do I need to add an extension to the php ini file (if so how do I do this)?

If that doesnt work the owner the github says "pass in ['phpiredis' => false] in the array of client options" how do I pass in options with composer?

Jonatha Suh
  • 195
  • 13

1 Answers1

1

The extension phpiredis woudl need to be added to php.ini to be loaded into the PHP process if you wanted to use it.

But - according to the predis-async composer file, that ext-phpiredis module is only a suggestion - so Composer doesn't require it. However, that's only the case for the latest version of the code - the last stable release, v0.2.3 explicitly requires it - which is what you are seeing.

My suggestion it to use the latest version of the code, with

# in the 'require' part of composer
"predis/predis-async": "dev-master",

You can also explicitly list a specific sha1-hash if you didn't want the code to potentially be able change from underneath you when updating or deploying.

That latest code has moved the extension to a suggestion.

The client options are in the 'Predis\Async\Client' constructor (called by your PHP code), an array as 2nd parameter after the address of the Redis server.

Alister Bulman
  • 34,482
  • 9
  • 71
  • 110
  • Thank you that worked! Also, if you are familiar with predis-async, I am following the example that it provides which connects and uses the pubSubLoop method to listen to a subscribed channel. It works when I run it on php, however, I am trying to listen to the messages on localhost using javascript. how could I connect to the server and listen? Could I could I call the server in Javascript? – Jonatha Suh Jul 21 '15 at 00:24
  • Sorry, I've never used predis-async, nor seen it till I answered the question. Calling Redis from Javascript is an entirely separate question - which would also (if done client side, and not from something server-side like NodeJS) bring up huge questions of security. – Alister Bulman Jul 21 '15 at 09:54