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. Ubuntu16.04 -- 后台进程Nohup

    nohup用于使程序在用户退出登陆.关闭终端之后仍能继续运行 用法: nohup your_command & #(符号&使程序在后台运行) exit #(退出nohup模式) 启动后 ...

  2. 愤怒的TryCatch

    本文地址:http://www.cnblogs.com/likeli/p/5719230.html 前言 本文不提供任何搭梯子之类的内容,我在这里仅仅讨论网络爬虫遇到的IP封杀,然后使用Tor如何对抗 ...

  3. ES查询tags字段为空或null

    现需要查询出tags为 "" 或者为 null 的数据 { "query": { "bool": { "must": { ...

  4. spring自动装配(No qualifying bean )

    No qualifying bean of type [com.wfj.service.cms.main.ChannelMng] found for dependency: expected at l ...

  5. 使用Spring开发和监控线程池服务

    第1步:添加maven 项目 第2步:添加依赖库 将Spring的依赖添加到Maven的pom.xml文件中. 1 2 3 4 5 6 7 8 9 10 11 <!-- Spring 3 dep ...

  6. [Angular] ngClass conditional

    Using ngClass for conditional styling, here is the usage from the docs: /** * @ngModule CommonModule ...

  7. SQL Server 2008 导入MDF数据库文件

    1.将.MDF和.LDF文件拷到SQL Server2008数据目录,如:\\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\ ...

  8. expect获取返回值

    对于获取多台server状态且不用交互须要用到expect,但有时候expect无法获取返回值.这里解释一下expect怎样获取返回值 expect -c "     spawn $1;   ...

  9. EasyUI datagrid 过滤事件段

    //dateTimeRange过滤扩展 $.extend($.fn.datagrid.defaults.filters, { dateRange: { /*onInit: function(targe ...

  10. charles用法详解

    Charles是目前最强大的http调试工具,在界面和功能上远强于Fiddler,同时是全平台支持,堪称圣杯级工具,唯一的缺陷是这货是收费的,而且是要¥50美元大洋…当然网上是有破解版的,鄙视下自己, ...