how do you install php-redis on php 7.0 on macos high sierra with homebrew or pecl?
Asked Answered
S

2

6

Trying to install redis extensions for php 7.0 on my high sierra apache.

brew install php-redis - doesn't work.

brew install [email protected] - doesn't work.

brew install php70-redis - doesn't work.

google google google - Homebrew is the wrong approach, use pecl, they say.

pecl search redis shows:

redis 4.0.2 (stable) 4.0.2 PHP extension for interfacing with Redis

so pecl install redis

pecl/redis is already installed and is the same as the released version 4.0.2 install failed

hmm. that's right. And I've put in the reference to the ini file:

cat /usr/local/etc/php/7.0/conf.d/ext-redis.ini

[redis] extension="/usr/local/lib/php/pecl/20160303/redis.so"

sudo service apachectl -k restart

check phpinfo() - no mention of redis but it does state that it is loading at the ext-redis.ini file.

Definately not loading, since if I try to use it on a php page I get

Fatal error: Uncaught phpFastCache\Exceptions\phpFastCacheDriverCheckException: Redis is not installed or is misconfigured, cannot continue.

What are the steps for getting redis connected in php on macos in 2018?

Sleek answered 24/5, 2018 at 0:51 Comment(2)
Perhaps try using Macports; sudo port install php-redisAntipater
I went to some lengths to explain here... https://mcmap.net/q/393426/-homebrew-install-new-formula-php72-imagick It should work the same way for php-redis.Caducous
S
5

I was struggling with same issue my issue is solved with bellow steps.

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

my php.ini path is this you can find php.ini path through phpinfo();/usr/local/etc/php/7.0/php.ini restart your php

brew services restart [email protected]

run make test. Redis support is enable .Now you can view in phpinfo()enter image description here

Shelbashelbi answered 22/10, 2018 at 8:34 Comment(1)
This help sort my issueDungaree
E
0

You may want to use "Predis" instead of "Redis" which is an applicative client designed for people that can't make use of php "Redis" extension. However your Redis service must be running and listening for internal connections.

Embalm answered 24/6, 2018 at 13:8 Comment(1)
Predis uses php redis on the lower level!Wedding

© 2022 - 2024 — McMap. All rights reserved.