linux下apache php配置redis
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的更多相关文章
- linux下安装与配置Redis
1.安装 (1)获取源代码 wget http://download.redis.io/releases/redis-4.0.8.tar.gz (2)解压 tar xzvf redis-4.0.8.t ...
- linux下如何安装配置redis及主从配置
redis的优点:支持主从备份,操作指令丰富,支持异步的数据持久化 将 redis 安装到 /usr/local/webserver/redis 1.下载安装包 wget http://redis.g ...
- linux下nginx php配置redis
之前一直遇到,Module compiled with module API=20090626这个坑问题!!! NOTICE: PHP message: PHP Warning: PHP Star ...
- LInux 下PHP环境配置 Redis 总结
系统 Deepin ,环境 PHP7.0 + Apache2 安装 Redis 服务 sudo apt-get install redis-server //安装 sudo /etc/init.d/r ...
- linux下apache+openssl配置记录
软件环境 Apache Httpd 2.2.29 (http://httpd.apache.org ) OpenSSL 1.0.1h (http://www.openssl.org/source ) ...
- Linux下 Apache Vhost 配置 防止403
首先,贴一份正确的配置(最简单的) <VirtualHost *:80> DocumentRoot /home/ubuntu/www/spider/public ServerName sp ...
- Linux下apache+phppgadmin+postgresql安装配置
Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...
- 分享:linux下apache服务器的配置和管理
linux下apache服务器的配置和管理. 一.两个重要目录: Apache有两个重要的目录:1.配置目录/etc/httpd/conf:2.文档目录/var/www: 二.两种配置模式: Apac ...
- Linux下Apache虚拟主机配置
Linux下Apache虚拟主机的三种配置.这样可以实现一台主机架构多个独立域名网站.其中基于域名的最为常见.性价比也最高.下面PHP程序员雷雪松详细的讲解下Linux下Apache虚拟主机配置的具体 ...
随机推荐
- 【转】Ehcache详细解读
Ehcache 是现在最流行的纯Java开源缓存框架,配置简单.结构清晰.功能强大,最初知道它,是从Hibernate的缓存开始的.网上中文的EhCache材料 以简单介绍和配置方法居多,如果你有这方 ...
- 去掉wget烦人的 “eta(英国中部时间)” 提示
gentoo 里的 wget ,从1.12版本开始,就一直有个不影响功能的小毛病:由于中文翻译的失误,进度提示的时候,会被拉成很多行.原因就是原来英文的ETA这3个字母,被翻译成了 “eta(英国中部 ...
- Hibernate3和4版本的不同
hibernate4的改动较大只有spring3.1以上版本能够支持,Spring3.1取消了HibernateTemplate,因为Hibernate4的事务管理已经很好了,不用Spring再扩展了 ...
- 配置Linux实现静态路由
配置Linux实现静态路由 背景和原理 路由器的功能是实现一个网段到另一个网段之间的通信,路由分为静态路由.动态路由. 默认路由和直连路由.静态路由是手工指定的,使用静态路由的好处是网络安全保密性高. ...
- [转]解决Docker容器时间与主机不一致问题
原文: https://blog.csdn.net/luckystar689/article/details/76572046 https://stackoverflow.com/questions/ ...
- 系统封装 如何打造原生WINPE
1 安装微软的AIK(Windows Automated Installation Kit,Windows自动安装工具包),AIK简体中文版下载地址: http://download.microsof ...
- ios多线程操作(四)—— GCD核心概念
GCD全称Grand Central Dispatch.可译为"大派发中枢调度器",以纯C语言写成,提供了很多很强大的函数.GCD是苹果公司为多核的并行运算提出的解决方式,它能够自 ...
- hdu 3667 /2010哈尔滨赛区H题 费用与流量为非线性关系/费用流
题意: 在一般费用流题目改动:路过某路,每x单位流量须要花费 ai*x^2(ai为给定的系数). 開始的的时候,一看仅仅只是是最后统计费用上在改动罢了,一看例子.发现根本没那么简单(ps:以后每次写程 ...
- psql命令行快速参考
psql的命令语法是: psql [options] [dbname [username]] psql命令行选项以及它们的意思在表1-1中列出.使用以下命令可以看到psql完整的选项列表: $ psq ...
- 杂(三)-The type java.lang.Object cannot be resolved It is indirectly referenced ...
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files ...