1, 安装 phpize(存在忽略)
yum install PHP-devel
2, 下载扩展源码包, 直接用 wget
wget https://github.com/edtechd/phpredis/archive/php7.zip
3 解压 php7.zip
unzip php7.zip
4. 解压目录为 pphpredis-php7, 进入该文件夹, 开始编译 PHP 扩展
- cd phpredis-php7
- /usr/bin/phpize // 具体用哪个要取决于你的 phpize 文件所在的目录, 这时你应该用 whereis phpize 来查看路径
执行完上一步, 我们就有了 configure 配置文件了.
5. 配置环境
./configure --with-PHP-config=/usr/bin/PHP-config
其中 PHP-config 和 phpize 所在的目录是相同的, 比如上面我用 /usr/bin/phpize, 则在这一步我用 ./configure -with-PHP-config=/usr/bin/PHP-config (其实如果你的 PHP 是默认安装路径的话, 直接 ./configure 就可以了, 个人而言吧)
6. 编译安装
make && make install
7, 配置 PHP.INI, 添加:
(配置 PHP 的配置文件 PHP.INI(具体放在那里可以用 whereis PHP.INI 来查看), 我的配置文件 PHP.INI 在 / etc / 下)
extension=Redis.so
8, 重启 PHP
在 PHP.info 中查看 Redis 信息
来源: http://www.bubuko.com/infodetail-2912570.html