Installing PHPRedis with PECL/Homebrew
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
I ran into trouble installing the PHP Redis extension installed on my Mac. Homebrew no longer installs PHP extensions and instead suggests you use PECL. However, it does not appear to work straight out of the box.
Running this command looks like it is going to work but fails instead.
First, remove the
pecl symlink that exists in your Homebrew PHP installation.
If preferred you can back this file up instead.
Next, adjust your PHP configuration contained in
/usr/local/etc/php/7.3. Remove the line
extension="redis.so" from the top of
/usr/local/etc/php/7.3/conf.d/ext-redis.ini and fill it with this content - adjusting in case the extension was installed elsewhere.
With that you'll be able to use PHPRedis with your local PHP installation (pending a restart if you have it running). This should drastically improve the performance of your interaction with Redis, and is easy to opt-in as the default Redis driver for Laravel.