Install phpredis on macOS Mojave

As of this PR phpredis is the new default client for Laravel v6.0 (and up) Applications, you may be want to install phpredis to test your Application in a real life environment using phpredis instead of predis (which is not getting any activity since a while at the time of writing).

UPDATE: Found out that the following command is all you need if you have pecl installed (https://stitcher.io/blog/php-73-upgrade-mac):

pecl install redis

You can install phpredis by running the following commands (found in this SO answer):

git clone https://www.github.com/phpredis/phpredis.git
cd phpredis
phpize && ./configure && make && sudo make install

After this, you need to enable the extension by adding extension="redis.so" to your used php.ini file:

code /usr/local/etc/php/$(php --version | head -n 1 | cut -d " " -f 2 | cut -d "." -f 1,2)/php.ini

After a restart of php (and if you have laravel/valet) you should be able to using phpredis.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top