1、安装redis

第一步:

下载:https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

上传phpredis-2.2.4.tar.gz到/usr/local/src目录

cd /usr/local/src #进入软件包存放目录

tar zxvf phpredis-2.2.4.tar.gz #解压

cd phpredis-2.2.4 #进入安装目录

/usr/local/php/bin/phpize #用phpize生成configure配置文件
如果出现:
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script. 用下面的方法解决:
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
# tar -zvxf autoconf-2.62.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install

第二步:

./configure --with-php-config=/usr/local/php/bin/php-config  #配置

make  #编译

make install  #安装

安装完成之后,出现下面的安装路径

/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

第三步:

vi /usr/local/php/etc/php.ini  #编辑配置文件,在最后一行添加以下内容

添加

extension="redis.so"

:wq! #保存退出

第四步:

/usr/local/apache2/bin/apachectl restart

第五步:

#cd /usr/local/apache2/htdocs

#touch redis.php

#vi redis.php

  编辑php文件

<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$redis=new \Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','helloworld');
echo $redis->get('test');
?>

  启动redis服务

cd /usr/local/src/redis-3.0.6/src

./redis-server

访问 IP/redis.php

显示

helloworld

参考: 

http://www.cnblogs.com/zgaspnet/p/3939198.html

http://www.cnblogs.com/jshen/archive/2013/07/05/3173729.html

linux下apache php配置redis的更多相关文章

  1. linux下安装与配置Redis

    1.安装 (1)获取源代码 wget http://download.redis.io/releases/redis-4.0.8.tar.gz (2)解压 tar xzvf redis-4.0.8.t ...

  2. linux下如何安装配置redis及主从配置

    redis的优点:支持主从备份,操作指令丰富,支持异步的数据持久化 将 redis 安装到 /usr/local/webserver/redis 1.下载安装包 wget http://redis.g ...

  3. linux下nginx php配置redis

      之前一直遇到,Module compiled with module API=20090626这个坑问题!!! NOTICE: PHP message: PHP Warning: PHP Star ...

  4. LInux 下PHP环境配置 Redis 总结

    系统 Deepin ,环境 PHP7.0 + Apache2 安装 Redis 服务 sudo apt-get install redis-server //安装 sudo /etc/init.d/r ...

  5. linux下apache+openssl配置记录

    软件环境 Apache Httpd 2.2.29 (http://httpd.apache.org ) OpenSSL 1.0.1h (http://www.openssl.org/source ) ...

  6. Linux下 Apache Vhost 配置 防止403

    首先,贴一份正确的配置(最简单的) <VirtualHost *:80> DocumentRoot /home/ubuntu/www/spider/public ServerName sp ...

  7. Linux下apache+phppgadmin+postgresql安装配置

    Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...

  8. 分享:linux下apache服务器的配置和管理

    linux下apache服务器的配置和管理. 一.两个重要目录: Apache有两个重要的目录:1.配置目录/etc/httpd/conf:2.文档目录/var/www: 二.两种配置模式: Apac ...

  9. Linux下Apache虚拟主机配置

    Linux下Apache虚拟主机的三种配置.这样可以实现一台主机架构多个独立域名网站.其中基于域名的最为常见.性价比也最高.下面PHP程序员雷雪松详细的讲解下Linux下Apache虚拟主机配置的具体 ...

随机推荐

  1. 装饰者模式对HttpServletRequest进行增强

    package cn.web.servlet; import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpS ...

  2. “/”和“\\”和feof();

    filename=c:/test/abc.text filename=c:\\test\\abc.test "\\"为转义字符: feof();函数检测文件是否已经到达末尾(EOF ...

  3. cbuffer padding

    nx glslc float 起始于 内存位置4x0 ,4x1,4x2 ,4x3.... bit float2 起始于 内存位置2x4x0 ,2x4x1,2x4x2 ,2x4x3.... bit fl ...

  4. EarlyZ disable( earlyz失效

    There are a few ways to disable EarlyZ list here: Shader depth output disabled Alpha test with depth ...

  5. zabbix自定义监控项二

    为zabbix增加支持传参的自定义监控项 例如使用zabbix来监控tcp的12种状态 tcp的12种状态可以通过man netstat来找到,即 LISTEN:等待从任何远端TCP 和端口的连接请求 ...

  6. 2017.4.12 开涛shiro教程-第十八章-并发登录人数控制

    原博客地址:http://jinnianshilongnian.iteye.com/blog/2018398 根据下载的pdf学习. 开涛shiro教程-第十八章-并发登录人数控制 shiro中没有提 ...

  7. sql习题练习

    表结构: create database MyCompany go use MyCompany go create table Departments ( Department_ID ,) prima ...

  8. poj 1719Shooting Contest

    //本题大意是对于一个r*c的矩阵,每一列有两个是白色的 //如今选c个位置,要求每一行至少有一个白色的方格被选上 //每一列仅仅能选一个 //用二分匹配求出最大匹配,假设最大匹配等于r,则满足 // ...

  9. STL学习笔记(数值算法)

    运用数值算法之前必须先加入头文件<numeric> 加工运算后产生结果 1.对序列进行某种运算 T accumulate(InputIterator beg,InputIterator e ...

  10. Bestcoders

    Senior's Fish Time Limit: 14000/7000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) T ...