Installing PHPRedis with PECL/HomebrewAugust 05, 2019
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.
pecl install redis
Running this command looks like it is going to work but fails instead.
Warning: mkdir(): File exists in System.php on line 294 Warning: mkdir(): File exists in ↵ /usr/local/Cellar/php/7.3.7/share/php/pear/System.php on line 294 ERROR: failed to mkdir /usr/local/Cellar/php/7.3.7/pecl/2010730
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.