Install phpredis MAC OSX
git clone https://www.github.com/phpredis/phpredis.git
cd phpredis
phpize && ./configure && make && sudo make install
Add extension=redis.so
in your php.ini
brew services restart [email protected]
make test
You can check working or not
php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"
As of 2019, with homebrew php7.2 and up, pecl
is now installed by default alongside the php binaries.
To see this for yourself type which pecl
.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type
pecl
to see the options.Issue
pecl install redis-5.0.2
. (or your version). Enter no to each question asked if you're not sure.If that succeeds check the new file it created at:
/usr/local/lib/php/pecl/20180731/redis.so
The install will have added
extension="redis.so"
to top of your php ini. Check that by opening the file/usr/local/etc/php/7.3/php.ini
. (assuming you're on 7.3 there)brew services restart php
.php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
This is what I just did in September 2019 and it works for me.