on 2019-06-19

Mac - php redis install

Mac Env

Mac OSX 10.14.5

Step

git clone https://www.github.com/phpredis/phpredis.git

cd phpredis

phpize && ./configure && make && sudo make install

test

php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"

Troubleshooting

phpize

1.

$ phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:

Solution

cd /Library/Developer/CommandLineTools/Packages/

open macOS_SDK_headers_for_macOS_10.14.pkg

2.

$ phpize
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

Solution

brew install autoconf

Refer - install-phpredis-mac-osx

Refer - macOS 10.14软件编译时找不到头文件的解决方法

Refer - macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法