下载 redis
redis-3.1.2.tgz
sudo tar -xzf redis-3.1.2.tgz
cd redis-3.1.2
sudo 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:
find / -name php-config
/usr/bin/php-config
sudo ./configure --with-php-config=/usr/bin/php-config
sudo make
In file included from /Users/anbaojia/redis-3.1.2/redis.c:27: ./common.h:1:10: fatal error: 'php.h' file not found #include "php.h" ^~~~~~~ 1 error generated. make: *** [redis.lo] Error 1
解决方法 我的mac 版本是10.14
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include /usr/include
sudo make install
如果报错
Permission denied
重启电脑 command+r 进入安全模式 csrutil disable
再重启
sudo make install
php -m|grep redis
redis
开启
redis-server
php.ihi
extension=redis.so
重启apache