php扩展redis,编译安装redis服务
首先安装redis扩展 https://github.com/phpredis/phpredis
下载
http://redis.io/download 服务软件 cd到软件存放目录
unzip phpredis-master.zip
cd phpredis-master
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
会得到
/usr/local/php/lib/php/extensions/no-debug-zts-20131226/redis.so cp php.ini-production /etc/php.ini这个是配置文件路径
如果你没有在编译的时候指定php的配置文件的路径,默认是/etc/下面
如果你不知道在哪,phpinfo的信息
| Configuration File (php.ini) Path | /etc |
| Loaded Configuration File | /etc/php.ini |
vi /etc/php.ini
加一句
extension=redis.so 重启nginx服务器和php-fpm
/usr/local/php/bin/php -m查看加载了redis模块 安装redis-server
tar -zxvf redis-2.8.19.tar.gz
cd redis-2.8.19
新版的貌似不能./configure --prefix=路径了
make
make install cp redis.conf /etc/
redis-server /etc/redis.conf
是前台运行,启动要改为后台运行
vi /etc/redis.conf
daemonize yes
/usr/local/src/redis/utils/redis_init_script 是脚本文件
现在把redis做为服务
ls
mkdir /etc/redis/
做为配置文件的路径
cp /usr/local/src/redis-2.8.19/utils/redis_init_script /etc/rc.d/init.d/redis
chkconfig --add redis
加入服务失败
vi /etc/rc.d/init.d/redis
#!/bin/bash
#chkconfig: 2345 80 90
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem. REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf" case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF &
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REDISPORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac
这个是修改好的配置文件
原文件是没有以下第2行的内容的,
$EXEC $CONF &
cp /usr/local/src/redis-2.8.19/redis.conf /etc/redis/6379.conf
chkconfig --add redis
chkconfig redis on
service redis start
redis-cli
vi /etc/redis/6379.conf
daemonize yes
就oK,查看redis服务是不是启动
netstat -tnlp
就OK了
php扩展redis,编译安装redis服务的更多相关文章
- PHP扩展Redis编译安装
PHP扩展Redis编译安装 1.下载PHP官方Redis源码包 wget http://pecl.php.net/get/redis-2.2.4.tgz 注:我用的是Redhat系统,ubunt ...
- CentOS 7.4 源码编译安装 Redis
一.CentOS 7.4 源码编译安装 Redis 1.下载源码并解压 wget http://download.redis.io/releases/redis-4.0.10.tar.gz tar ...
- Docker容器编译安装Redis
Docker容器编译安装Redis 1.创建容器 -i 交互模式 -d 后端运行 -h 容器的hostname --name 容器名 --network 网卡 --ip IP地址 -p 端口映射 -- ...
- 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装
系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...
- Linux 通过编译安装apache服务以及配置
Linux 编译安装apache服务 一.安装 1.通过编译安装,首先需要下载源代码安装包 apache下载链接:http://httpd.apache.org/download.cgi 2.解开源代 ...
- Asp.net MVC + Redis(Linux安装Redis)
最近有幸在工作中用到了redis,玩的还算开心.但是发现Redis在Windows上并不是满血状态的,所以决定安装一个Linux的虚拟机,让Redis在Linux上运行. 虚拟环境 虚拟机,我已经玩了 ...
- Yii2使用Redis - 从安装redis到使用 [ 2.0 版本 ]
Yii2使用Redis - 从安装redis到使用 [ 2.0 版本 ] 一.安装Redis和简单配置 1. 下载Redis安装包 地址:http://redis.io/download , 本文选择 ...
- 解决mysql跟php不在同一台机器上,编译安装php服务报错问题:configure: error: Cannot find MySQL header files under /application/mysql.
在编译安装php服务时报错: configure: error: Cannot find MySQL header files under /application/mysql. Note that ...
- 编译安装php服务报错问题:configure: error: Cannot find libmysqlclient under /usr.
在编译安装php服务时报错: checking for MSSQL support via FreeTDS... nochecking for MySQL support... yeschecking ...
随机推荐
- Json简介与转换数据例子
Json是什么,Json就是javascript对象或者数组格式的字符串,Http协议不能传递JavaScript对象,所以要转换为字符串进行传输.AJAX传递复杂数据如果自己进行格式定义的话会经历组 ...
- backslash and newline separated by space
原来是因为\ 后面多了一个空格 检查写的代码中将\后面的空格去掉就可以了.
- Java中栈结构的自我实现
package com.pinjia.shop.common.collection; /** * Created by wangwei on 2017/1/3. */ public class MyL ...
- php 克隆和引用类
/*class Ren { public $name; public $sex; function __construct($n,$s) { $this->name=$n; $this-> ...
- python file.tell() 在windows下需要注意的地方
顺便记一下,'rba'模式是非法的...
- [译] Web API 之 简介
事实上,MVC 框架本身已经提供了构建REST风格服务的基础,而Web API 只是让你可以更加容易和快捷的构建REST服务. 特性 基于约定的 CRUD Actions: 自动按照HTTP的acto ...
- hdu 3183 贪心
题意:给一个数字,删掉其中的若干位,使得最后的数字最小 就是每次删除数的时候都是删掉第一个比右边数大的数 利用双向链表模拟 #include<cstdio> #include<ios ...
- APP性能分析1
我们使用云测试平台对产品进行了性能测试,情况如下: 详见这里.
- MATLAB学习笔记(六)——MATLAB数据分析与多项式计算
(一)数据处理统计 一.最大值和最小值 1.求向量的最大值和最小值 y=max(X); %返回向量X的最大值存入y,如果X中含有复数则按模最大的存入y [y,I]=max(X);%返回向量X的最大值存 ...
- error opening trace file: No such file or directory (2) ,can't load transform_config.xml
出现这个错误:error opening trace file: No such file or directory (2) ,can't load transform_config.xml 是因为没 ...