Mac下XAMPP安装Redis扩展

参考链接:

http://blog.csdn.net/d18826252059/article/details/53081991

http://www.cnblogs.com/lyFocus/p/6261574.html

http://blog.csdn.net/lovely_1014/article/details/54096513

1. 下载redis

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

2. 解压

tar xzf phpredis

3. 进入redis目录

cd phpredis

4. 执行命令

sudo /Applications/XAMPP/xamppfiles/bin/phpize

注意:如果执行上述命令时出现以下问题

Configuring for:

php Api Version:         20041225

Zend Module Api No:      20060613

Zend Extension Api No:   220060519

Cannot find autoconf. Please check your autoconf installation and the  $PHP_AUTOCONF  environment variable is set correctly and then rerun this script.

按照以下命令一步步执行可解决问题:

wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz

tar -zvxf m4-1.4.9.tar.gz

cd m4-1.4.9/

./configure && make && make install

cd ../

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz

tar -zvxf autoconf-2.62.tar.gz

cd autoconf-2.62/

./configure && make && make install

完成后,再次执行 sudo /Applications/XAMPP/xamppfiles/bin/phpize

5. 执行命令

sudo MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load" ./configure--enable-redis--with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config

6. 执行命令

sudo make && sudo make install

7. 执行命令 (phpredis目录下)

cp ./ modules/redis.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/redis.so

8. php.ini修改

vi /Applications/XAMPP/xamppfiles/etc/php.ini

添加:extension=redis.so

9. 重启apache

你可能感兴趣的:(Mac下XAMPP安装Redis扩展)