Brew Install PHP Redis on MacOS High Sierra 10.13

After upgrading to MacOS High Sierra (or any upgrade process previously), first thing I need to check is the local webserver status: apache, php, redis, mysql. Brew install php redis. Thankfully, MacOS High Sierra is now shipped with PHP 7.1 installed, which met the new standard for my future web developments. PHP-redis is a must-installed […]

MacOS

After upgrading to MacOS High Sierra (or any upgrade process previously), first thing I need to check is the local webserver status: apache, php, redis, mysql. Brew install php redis. Thankfully, MacOS High Sierra is now shipped with PHP 7.1 installed, which met the new standard for my future web developments.

PHP-redis is a must-installed library since I love the MySQL + Redis tandem for handling data storage and requests. Of course, along with the newly upgraded OS, the Apache installation in fresh installed with standard « It works! » welcome page.

Now, into the installation steps.

1. Install php71-redis Library

Easier said, I simply shot brew install php71-redis into Terminal and then served with Error, suggesting that I need to install Xcode Command Line Tools.

xcode-select --install

2. Unlink Previous PHP 5.6 Libraries

I tried to install again the library, but another error came along. It said the installed formulae was conflicting: different php versions install the same binaries. It suggested me to unlink all php 5.6 libraries. Ok then..

brew unlink php56

3. Install php71-redis (Again)

Hopefully this attempt for installing php71-redis library was a successful one.

brew install php71-redis

brew install php redis php7.1 macos high sierra

4. Edit php.ini; Include php71-redis Extension

Edit /etc/php.ini, add the extension as follows. If the php.ini file not exist, copy the php.ini~previous. Don’t forget to include the igbinary extensions too, so you won’t get problem my previous php56-redis module not loaded here.

5. Restart Apache

Final steps

sudo apachectl restart