随笔- 71  评论- 2  文章- 0 

mamp pro安装redis扩展 各个步骤

1,先在mamp面板中查看php版本:7.1.8

2,~ sunny$cd /Applications/MAMP/bin/php/php7.1.8

3,git clone https://github.com/nicolasff/phpredis.git

4,php7.1.8 sunny$ls

bin conf include lib modules phpredis

5,phpredis sunny$/Applications/MAMP/bin/php/php7.1.8/bin/phpize

Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

注意:因为提示 Cannot find autoconf. 所以需要先安装:

phpredis sunny$brew install autoconf
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/autoconf-2.69.high_sierra.bot
######################################################################## 100.0%
==> Pouring autoconf-2.69.high_sierra.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/autoconf
==> Summary
🍺 /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB

安装后再重新执行:

phpredis sunny$/Applications/MAMP/bin/php/php7.1.8/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
phpredis sunny$

6,phpredis sunny$./configure --with-php-config=/Applications/MAMP/bin/php/php7.1.8/bin/php-config

checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc

7,phpredis sunny$make

/bin/sh /Applications/MAMP/bin/php/php7.1.8/phpredis/libtool --mode=compile cc -I. -I/Applications/MAMP/bin/php/php7.1.8/phpredis -DPHP_ATOM_INC -I/Applications/MAMP/bin/php/php7.1.8/phpredis/include -I/Applications/MAMP/bin/php/php7.1.8/phpredis/main -I/Applications/MAMP/bin/php/php7.1.8/phpredis -I/Applications/MAMP/bin/php/php7.1.8/include/php -I/Applications/MAMP/bin/php/php7.1.8/include/php/main -I/Applications/MAMP/bin/php/php7.1.8/include/php/TSRM -I/Applications/MAMP/bin/php/php7.1.8/include/php/Zend -I/Applications/MAMP/bin/php/php7.1.8/include/php/ext -I/Applications/MAMP/bin/php/php7.1.8/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Applications/MAMP/bin/php/php7.1.8/phpredis/redis.c -o redis.lo

8,phpredis sunny$make test

Build complete.
Don't forget to run 'make test'.

9,打开 MAMP,在左上角 File 菜单-> Edit Template-> PHP-> 7.1.8 版本打开 php.ini 中找到 Dynamic Extensions 区域添加扩展:extension=redis.so

10,将 php7.1.8/phpredis/modules/redis.so 复制到 php.ini 中 extension_dir = "/Applications/MAMP/bin/php/php7.1.8/lib/php/extensions/no-debug-non-zts-20160303/" 里面。

11,启动redis :phpredis sunny$redis-server

12,查看redis与关闭服务:~ sunny$cd /Applications/MAMP/bin/php/php7.1.8/phpredis
phpredis sunny$ps axu|grep redis
sunny 7900 0.0 0.0 4297012 2100 ?? S 1:51下午 0:01.13 redis-server *:6379
sunny 8405 0.0 0.0 4267768 900 s001 S+ 2:17下午 0:00.00 grep redis
phpredis sunny$redis-cli shutdown
phpredis sunny$ps axu|grep redis
sunny 8409 0.0 0.0 4267768 900 s001 S+ 2:18下午 0:00.00 grep redis

 

posted on 2019-03-04 14:03 风小可 阅读(...) 评论(...) 编辑 收藏