Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 470
frumbert Avatar asked May 24 '18 00:05

frumbert


People also ask

What is PHP Redis extension?

The phpredis extension provides an API for communicating with the Redis key-value store. It is released under the PHP License, version 3.01.


1 Answers

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

like image 162
Nanhe Kumar Avatar answered Oct 03 '22 03:10

Nanhe Kumar