Git地址https://github.com/nicolasff/phpredis

一、安装:

phpize
./configure
make && make install

其中,添加PHP扩展需要用到 phpize,所以我们需要安装 php-devel 这个包。

  1. yum install php-devel
  2. 然后编译安装phpredis:
  3. git clone git://github.com/nicolasff/phpredis.git
  4. cd phpredis
  5. phpize
  6. ./configure --with-php-config=/usr/bin/php-config --enable-redis
  7. make
  8. make install

安装成功后,模块会被安装到系统上,显示如下:

  1. Installing shared extensions:     /usr/lib64/php/modules/
  2. 执行:ls  /usr/lib64/php/modules/
  3. 显示有:redis.so

编辑配置文件:php.ini :

  1. extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626"        //PHP扩展路径
  2. ; Enable redis extension module
  3. extension=redis.so                      //开启redis扩展

最后重启WEB服务器即可!


二、测试:

在命令行里执行:php -m ;发现有redis,表明扩展安装成功!

写个测试脚本

  1. <?php
  2. $redis = new Redis();
  3. $redis->connect('127.0.0.1', '6379');
  4. for($i = 0; $i < 100; $i++) {
  5. echo  $redis->ping();
  6. }

结果输出

  1. +PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG
  2. +PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG
  3. +PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG
  4. +PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG
  5. +PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG+PONG

Centos系统安装 phpredis 扩展的更多相关文章

  1. CentOS 7 PHP-redis扩展安装,浏览器不显示数据及redis无法储存数据常见问题解决办法

    首先使用php -m 可以查看到自己安装了那些扩展. 1.使用wget下载redis压缩包 wget https://github.com/phpredis/phpredis/archive/deve ...

  2. Centos 安装PHP-redis扩展

    从https://pecl.php.net/package/redis   里面找到自己安装的Redis对应版本的redis 1.获取已经安装的Redis版本扩展我这边安装的是4.0.1版本 wget ...

  3. centos安装redis及php-redis扩展

    centos安装redis及php-redis扩展  Linux, WEB 七162012 今天公司同事要求在测试机上安装redis,并且要求让php安装上redis的扩展,redis是一个key-v ...

  4. CentOS 7下安装php-redis扩展及简单使用

    前言: 在本篇文章中,我将给大家介绍如何在CentOS7上安装PHP-Redis扩展以及一些简单的实用,关于如何在Centos上安装redis的,可以参考 Redis在CentOS 7上的安装部署   ...

  5. centos redis 安装 php-redis扩展安装 及使用

    前提:centos7.php7 安装redis-server 1:yum install redis 编译安装php-redis 扩展 1:下载编译安装 wget https://codeload.g ...

  6. CentOS 7 & php7.2安装 php-redis 扩展

    CentOS 7 & php7.2安装 php-redis 扩展 1.下载phpredis-developcd /tmpwget https://codeload.github.com/php ...

  7. CentOS7 安装Redis和PHP-redis扩展

    aemonize yes Redis是一个key-value存储系统,属于我们常说的NoSQL.它遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的AP ...

  8. Linux部署Redis及PHP-redis扩展

    Redis是一个key-value存储系统,属于我们常说的NoSQL.它遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.它常用在缓存.队列.P ...

  9. linux下Redis与phpredis扩展安装

    ++++++++++++++++++++++++++++++++++++++++++++++linux下Redis与phpredis扩展安装++++++++++++++++++++++++++++++ ...

随机推荐

  1. all rows from client_id can grow infinitely compared to a single node when hashing by client_id

    all rows from client_id can grow infinitely compared to a single node when hashing by client_id Re: ...

  2. 在Windows上使用libcurl发起HTTP请求

    curl下载地址https://curl.haxx.se/download.html 当前最新版本为7.61.0 将下载的curl-7.61.0.zip解压,得到curl-7.61.0 在目录curl ...

  3. rails用generate为两个模型创建has_and_belongs_to_many中间表

    假设 teachers和students具备many-to-many的关系,那么需要一个Join 表,has_and_belongs_to_many默认该表名字为teachers_students,这 ...

  4. safair 的css hack

    在css里面使用[;attribute:value;] css参考如下: .header-share li{float: right; margin-left: 20px; [;width: 50px ...

  5. html5--6-68 实战前的准备工作:了解HTML5大纲算法

    html5--6-68 实战前的准备工作:了解HTML5大纲算法 学习要点 了解HTML5大纲算法 在html5中有一个很重要的概念,叫做HTML5大纲算法(HTML5 Outliner),它的用途为 ...

  6. ES6之Object

    对象属性模型的相关方法: 对象自身所有属性名称 Object.getOwnPropertyNames(obj)              //[] 获取某个属性的attribute对象 Object. ...

  7. 为什么python2.7中用Process创建子进程的语句之前必须加#if

    from multiprocessing import Process import os def run(name): print 'The child process '%s' (pid %d) ...

  8. Bootstrap-CSS:按钮

    ylbtech-Bootstrap-CSS:按钮 1.返回顶部 1. Bootstrap 按钮 本章将通过实例讲解如何使用 Bootstrap 按钮.任何带有 class .btn 的元素都会继承圆角 ...

  9. HTML中的align和valign这两个属性

    转自:https://www.douban.com/note/325833958/ align和valign属性均是规定表格相对于周围元素的对齐方式,区别就在于: 1.align属性趋向于左右对齐,其 ...

  10. 洛谷 - P1111 - 修复公路 - 并查集

    https://www.luogu.org/problemnew/solution/P1111 并查集的水题,水题都错了好多发. 首先并不是有环就退出,而是连通分支为1才退出,每次合并成功连通分支才会 ...