几天来,我正在尝试安装php-redis扩展名。
尝试使用brew并获得此...
$ brew install php71-redis
Error: No available formula with the name "php71-redis"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
试图通过PECL安装并获得此...
$ sudo pecl install redis
downloading redis-4.1.0.tgz ...
Starting to download redis-4.1.0.tgz (220,774 bytes)
..............................................done: 220,774 bytes
25 source files, building
running: phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
************
************
checking whether to enable igbinary serializer support... yes
checking whether to enable lzf compression... yes
checking use system liblzf... no
checking for igbinary includes... configure: error: Cannot find igbinary.h
ERROR: `/private/tmp/pear/install/redis/configure --with-php-config=/usr/bin/php-config --enable-redis-igbinary=нуы --enable-redis-lzf=yes' failed
最后尝试安装igbinary.h ....
$ sudo pecl install igbinary
downloading igbinary-2.0.7.tgz ...
Starting to download igbinary-2.0.7.tgz (73,523 bytes)
************
************
Build process completed successfully
Installing '/usr/include/php/ext/igbinary/igbinary.h'
ERROR: failed to mkdir /usr/include/php/ext/igbinary
为此,请尝试在OSx(Mac)上禁用csrutil:
csrutil disable
中应该工作。
我刚刚在Mac OS 10.13上做到了(我仍在使用High Sierra)。
使用自制php7.2及更高版本,pecl
现在默认情况下与php二进制文件一起安装。
要亲自查看,请键入which pecl
。
安装步骤
检查您的redis版本,然后找到合适的扩展名here。
如果不熟悉pecl,请键入pecl
以查看选项。
问题pecl install redis 5.0.2
。 (或您的版本)。对不确定的每个问题输入否。
如果成功,请检查它在以下位置创建的新文件:/usr/local/lib/php/pecl/20180731/redis.so
该安装会将extension="redis.so"
添加到您的php ini顶部。通过打开文件/usr/local/etc/php/7.3/php.ini
进行检查。(假设您使用的是7.3)
brew services restart php
。
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
此操作于2019年9月完成,对我有用。