php56-redis Module Not Loaded in PHP-CGI macOS Sierra

August 6, 2017

After macOS Sierra 10.12.6 Update, my php56-redis module is not working, causing some of my PHP applications cannot communicate with Redis as storage engine. My confusion raises when the module is loaded in PHP-CLI but not in PHP-CGI. It means, if I type php -m in command line, redis shows up. But, if I access via browser via phpinfo(); nothing says about redis.

I googled for nearly two days, until I realized that I haven’t look for a file which I should investigate the first time any errors occured in PHP: error_log. In macOS, the logs are located in /var/log/apache2/ so the file is located on /var/log/apache2/error_log.

I open the file via Sublime and then voila … Here comes the essential hint.

PHP Warning:  Cannot load module 'redis' because required module 'igbinary' is not loaded in Unknown on line 0

I remember that I never typed any of these igbinary module in php.ini, so this is new case for me. Maybe after macOS Sierra last update, the module is not loaded automatically.

php56-redis Module Must Be Defined Manually in php.ini

I’m sure I have this igbinary module installed, however I try to install it again via Homebrew. Of course, it results in error message homebrew/php/php56-igbinary 2.0.4 already installed. This means the binary has been installed within the modules directory, all I need to do is define its inclusion within the php.ini file.

php56-redis module: php56-igbinary extension must be loaded manually within php.ini

I add one line statement right before the php56-redis module extension.


Restart apache, then everything just back to normal, like the good ol’ days.