===============redis 安装==========================

直接yum 安装的redis 不是最新版本

yum install redis

如果要安装最新的redis,需要安装Remi的软件源,官网地址:http://rpms.famillecollet.com/

yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

然后可以使用下面的命令安装最新版本的redis:

yum --enablerepo=remi install redis

安装完毕后,即可使用下面的命令启动redis服务

systemctl start redis

redis安装完毕后,我们来查看下redis安装时创建的相关文件,如下:

rpm -qa |grep redis

rpm -ql redis

查看redis版本:

redis-cli --version

设置为开机自动启动:

systemctl enable redis.service

Redis开启远程登录连接,redis默认只能localhost访问,所以需要开启远程登录。解决方法如下:

在redis的配置文件/etc/redis.conf

bind 127.0.0.1 改成了 bind 0.0.0.0

然后要配置防火墙 开放端口6379

连接redis

redis-cli

=================php-redis 拓展安装===================

使用git clone下载git上的phpredis扩展包

[root@VM_103_117_centos ]#git clone  https://github.com/phpredis/phpredis.git

到了这一步,我们要使用安装php时生成的phpize来生成configure配置文件,

//具体用哪个要取决于你的phpize文件所在的目录,这时你应该用 whereis phpize 来查看路径

[root@VM_103_117_centos phpredis]# whereis phpize
phpize: /usr/bin/phpize /usr/share/man/man1/phpize.1.gz

这里表明路径为/usr/bin/phpize,然后执行:

[root@VM_103_117_centos phpredis]# /usr/bin/phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.

这里报错了,原因是没有安装好php-devel,由于我是使用的php7.0所以执行以下命令:

[root@VM_103_117_centos phpredis]#yum -y install php70w-devel

然后再次执行:

[root@VM_103_117_centos phpredis]# /usr/bin/phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012

执行完上一步,我们就有了 configure 配置文件了,接下来配置

[root@VM_103_117_centos phpredis]#./configure

或者执行

[root@VM_103_117_centos phpredis]#./configure --with-php-config=/usr/bin/php-config

接下来是编译安装

[root@VM_103_117_centos phpredis]#make

[root@VM_103_117_centos phpredis]# make install
Installing shared extensions: /usr/lib64/php/modules/

配置php的配置文件php.ini(具体放在那里可以用 whereis php.ini 来查看),我的配置文件php.ini在/etc/下

[root@VM_103_117_centos phpredis]#vim /etc/php.ini

加入下面几行:

[redis]
extension_dir =/usr/lib64/php/modules/
extension = redis.so

redis.so文件的路径可以在make install的时候看到

重启apache服务器,使配置生效

[root@VM_103_117_centos phpredis]#systemctl restart httpd.service

重启之后我们打开info.php,已经可以看到redis的扩展信息了

最新文章

  1. POJ2743Mobile Computing[DFS 状态压缩]
  2. VS2012 快捷键
  3. Android Log日志文件的分析、查看
  4. 转载:mysql-Auto_increment值修改
  5. Euromonitor 2013年奢侈品报告精选 |华丽志
  6. 使用uWSGI+nginx部署Django项目
  7. 高精度运算专题2-减法运算(The subtraction operation)
  8. angular Jsonp的坑
  9. mfc---右键蹦出菜单
  10. 初次尝试Linux并记录一二
  11. [bzoj1969] [Ahoi2005]LANE 航线规划
  12. [机器学习Lesson 2]代价函数之线性回归算法
  13. Failure sending mail: The user or group name 'xxx\xxxx' is not recognized.Mail will not be resent
  14. 【CF1152F】Neko Rules the Catniverse(动态规划)
  15. Java开发人员必须掌握的Linux命令-学以致用(5)
  16. BUAA_OO第一单元作业总结
  17. 6 week work 3
  18. 如何解决win10关机状态下,按键盘会自动开机的问题
  19. CentOS tree命令详解
  20. 【BZOJ1717】[Usaco2006 Dec]Milk Patterns 产奶的模式 后缀数组

热门文章

  1. linux下shell显示git当前分支
  2. android测试开发概念
  3. sshpass非交互SSH密码验证
  4. python学习第八天二进制和字符编码有关联
  5. HDU 6315 Naive Operations 【势能线段树】
  6. tornado后台小框架
  7. sig文件制作
  8. 关于在IE下JavaScript的 Stack overflow at line 错误可能的原因
  9. how to pass variable from shell script to sqlplus
  10. java 接口概念及使用