mamp pro安裝redis擴展 各個步驟

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

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

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

4,php7.1.8 sunny$lsredis

bin conf include lib modules phpredisphp7

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

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.this

注意:由於提示 Cannot find autoconf. 因此須要先安裝:spa

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.0MBdebug

安裝後再從新執行:
server

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/phpredisphpredis sunny$ps axu|grep redissunny 7900 0.0 0.0 4297012 2100 ?? S 1:51下午 0:01.13 redis-server *:6379sunny 8405 0.0 0.0 4267768 900 s001 S+ 2:17下午 0:00.00 grep redisphpredis sunny$redis-cli shutdownphpredis sunny$ps axu|grep redissunny 8409 0.0 0.0 4267768 900 s001 S+ 2:18下午 0:00.00 grep redis

相關文章
相關標籤/搜索