參考鏈接:
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. 進(jìn)入redis目錄
cd phpredis
4. 執(zhí)行命令
sudo /Applications/XAMPP/xamppfiles/bin/phpize
注意:如果執(zhí)行上述命令時出現(xiàn)以下問題
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.
按照以下命令一步步執(zhí)行可解決問題:
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
完成后,再次執(zhí)行 sudo /Applications/XAMPP/xamppfiles/bin/phpize
5. 執(zhí)行命令
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. 執(zhí)行命令
sudo make && sudo make install
7. 執(zhí)行命令 (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