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 ...
随机推荐
- innobackupex err2
报错: [root@DB dbdata]# innobackupex --defaults-file=/etc/my.cnf --user=root --password=123 /data/dbda ...
- rsync实时同步文件
http://rsync.samba.org/download.html [root@v01 src]# yum install git [root@v01 src]# git clone git:/ ...
- wpa_supplicant.conf
转自:http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf ### ...
- inner join、left join、right join等的区别
left join :左连接,返回左表中所有的记录以及右表中连接字段相等的记录.right join :右连接,返回右表中所有的记录以及左表中连接字段相等的记录.inner join: 内连接,又叫等 ...
- 理解ASP.NET 5的中间件
今天推荐的这篇文章,讲述了如何实现和使用ASP.NET 5的中间件. 虽然在ASP.NET 5中,微软没有再强调OWIN(Open Web Interface for .NET)及其微软官方的OWIN ...
- pl/sql developer 登陆提示ORA-12514(转)
pl/sql developer 登陆提示ORA-12514 说明监听服务已经起来了 备注:通过 lsnrctl 命令来启动/停止/查看/重载监听器/服务 lsnrctl start|stop|s ...
- 编辑WCF配置不出现
在使用VS2010创建
- WebService站点服务的地址
天气的地址 http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx
- C++的那些事:流与IO类
1.流的概念 "流"就是"流动",是物质从一处向另一处流动的过程,比如我们能感知到的水流.C++的流是指信息从外部输入设备(如键盘和磁盘)向计算机内部(即内存) ...
- hdu 2545(并查集求节点到根节点的距离)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2545 思路:dist[u]表示节点u到根节点的距离,然后在查找的时候更新即可,最后判断dist[u], ...