越简单越好!

MacOS 下安装 php redis扩展

发表于 2014-11-02 16:37 | 483次阅读 0次点赞   PHP
#先下载php-redis https://github.com/nicolasff/phpredis/releases

#解压phpredis-2.2.5

mv phpredis-2.2.5/ /usr/include/php/ext/phpredis
cd /usr/include/php/ext/phpredis
sudo phpize
sudo ./configure
sudo make
sudo make install
#在php.ini里加上 extension=redis.so
#重启apache
sudo apachectl restart
#大功告成。


1.如果执行 phpize 提示如下错误:

Cannot find autoconf. Please check your autoconf installation
and the $PHP_AUTOCONF environment variable.
解决办法:
#可以使用macports安装(如果没有macports可以从官网下载http://www.macports.org/install.php)

sudo port install autoconf
2.执行执行 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:
解决办法:

#MacOs10.9

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include
#MacOs10.10
#下载 php.zip 解压到/usr/include/php



返回顶部 ^