1. 安装redis
Redis安装流程请移步 https://www.cnblogs.com/IT-Crowd/articles/10626765.html
2. 下载Redis扩展
[root@root php-extension]# wget https://pecl.php.net/get/redis-4.3.0.tgz
3. 解压 tar -zxvf redis-4.3.0.tgz
[root@root php-extension]# tar -zxvf redis-4.3.0.tgz
4. 生成configure配置文件
[root@root php-extension]# cd redis-4.3.0
[root@root redis-4.3.0]# /usr/local/php/bin/phpize
5.安装redis扩展
[root@root redis-4.3.0]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@root redis-4.3.0]# make && make install
安装完成提示:
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/
6.在php.ini中添加Redis扩展
首先配置extension_dir:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/"
在extension_dir下面添加 extension = redis.so
7.重启PHP
[root@root redis-4.3.0]# service php-fpm restart
8.Redis扩展安装成功