mac中怎样通过brew 安装php的redis扩展

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mac中怎样通过brew 安装php的redis扩展相关的知识,希望对你有一定的参考价值。

1、下载php-redis;
2、下载完后进行解压,然后移动到系统自带php的同级目录;①
cp /Users/panxu/Desktop/phpredis /etc

3、进入phpredis;

cd /etc/phpredis

4、动态安装php扩展模块;②

/usr/bin/phpize

5、进行编译;

./configure --with-php-config=/usr/bin/php-config

6、开始安装;

make && make install

安装完成,如果成功,会有如下提示:

Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20160303/

7、找到php.ini文件,并进行编辑;③

vi php.ini

在配置文件最后一行加入:

extension=redis.so

8、重启php-fpm,完成安装。④
步骤中的涉及到的资源和详细解释请参考:https://panxu.net/article/8400.html
参考技术A 具体的Updating Homebrew...
Error: No available formula with the name "php56-redis"
==> Searching for a previously deleted formula...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.

2
解决办法就是在brew中添加tap
# brew tap homebrew/homebrew-php
等待命令执行结束

3
现在再安装 php56-redis 扩展
# brew install php56-redis
就能安装成功了,此过程需要一些时间,大概十分钟左右

4
不要忘了重启apache
# sudo apachectl restart
5
可能此时你通过访问phpinfo页面看不到安装好的扩展,
查看已经安装的php模块
# php -m
在这里会有提示安装失败的警告或者错误
我的提示
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-redis/redis.so' - dlopen(/usr/local/opt/php56-redis/redis.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic 如果你还不明白的话,你可以在后盾人平台看看教材视频,多看看几遍,慢慢的不就会了加油(๑> ㉨ <)☆  (~㉨~)本回答被提问者采纳

mac brew install redis 报错

/usr/local/opt/php55/bin/phpize

/usr/local/opt/php55/bin/phpize: line 61: /usr/local/Library/ENV/4.3/sed: No such file or directory
/usr/local/opt/php55/bin/phpize: line 62: /usr/local/Library/ENV/4.3/sed: No such file or directory
/usr/local/opt/php55/bin/phpize: line 63: /usr/local/Library/ENV/4.3/sed: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:  
/usr/local/opt/php55/bin/phpize: line 155: /usr/local/Library/ENV/4.3/sed: No such file or directory
autoheader: error: AC_CONFIG_HEADERS not found in configure.in
采纳
vi `which phpize`

找到 SED="/usr/local/Library/ENV/4.3/sed" 改成 SED="/usr/bin/sed"

以上是关于mac中怎样通过brew 安装php的redis扩展的主要内容,如果未能解决你的问题,请参考以下文章

mac中怎样通过brew 安装php的redis扩展

mac中怎样通过brew 安装php的redis扩展

mac中怎样通过brew 安装php的redis扩展

Mac 使用brew安装phpredis扩展

Mac安装php和redis扩展

Mac下通过 brew 安装 Apache 和 PHP