安装redis服务
1 下载redis
cd /usr/local/ 进入安装目录
wget http://download.redis.io/redis-stable.tar.gz
2 解压安装
tar xvzf redis-stable.tar.gz
cd redis-stable
make && make install
3 配置redis

拷贝配置文件到/etc/redis/redis.conf
cp redis.conf /etc/redis/6379redis.conf

vim /etc/redis/redis.conf
修改文件 把 daemonize 这一项改成 yes
增加:pidfile /var/redis/run/redis_6379.pid
增加:logfile /var/redis/log/redis_6379.log
增加:dir /var/redis/6379
保存退出
最后运行redis:
redis-server /etc/redis/redis.conf
查看端口【6379】
netstat –atln
4 打开客户端
进入安装目录打开 cd redis-stable/src/redis-cli

安装php-redis扩展
1 下载redis扩展
php-redis下载地址 https://github.com/phpredis/phpredis
2 解压安装
unzip phpredis-develop.zip
cd phpredis-develop
生成configure配置文件: /usr/local/php/bin/phpize
编译安装: ./configure --with-php-config=/usr/local/php-7.1/bin/php-config
make && make install
3 编辑php.ini文件
vim /usr/local/php/etc/php.ini
在文件末尾加上: extension=redis.so
4 重启httpd
5 phpinfo 查看

总结
以上所述是小编给大家介绍的Linux下 php7安装redis的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!