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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM