brew install redis
brew services start redis
https://github.com/phpredis/phpredis/releases/
我目前最新的是5.3.4
cd phpredis5.3.4
phpize
./configure
make
make test
make install
运行之后会出现路径,将路径写在
sudo vim /usr/local/etc/php/7.2/php.ini
我的是之前加过一个自定义的扩展,所以这次我将redis.so复制到之前的文件夹下
在./modules/redis.so 找到redis.so
brew services restart php@7.2
php -m
看到有redis
brew services list
brew link --overwrite php@7.2
open ./
查看服务端版本
redis-server-v
查看客户端版本
redis-cli-v
/usr/local/etc/php/7.2/php.ini
yum install -y gcc
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -zxvf redis-5.0.3.tar.gz
cd redis-5.0.3
make
make install PREFIX=/usr/local/redis
cd /usr/local/redis/bin/
./redis-server
cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/
修改redis.conf->daemonize no 改为 daemonize yes
vi redis.conf
后台启动
./redis-server redis.conf
vi /etc/systemd/system/redis.service
复制边配置
[Unit]
Description=Redis
After=network.target
[Service]
ExecStart=/usr/local/bin/redis-server /usr/local/redis/redis.conf --daemonize no
ExecStop=/usr/local/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown
[Install]
WantedBy=multi-user.target
systemctl enable redis.service
systemctl start redis.service #启动redis服务 systemctl stop redis.service #停止redis服务 systemctl restart redis.service #重新启动服务 systemctl status redis.service #查看服务当前状态 systemctl enable redis.service #设置开机自启动 systemctl disable redis.service #停止开机自启动
参考地址:
https://www.cnblogs.com/heqiuyong/p/10463334.html
https://www.cnblogs.com/zuidongfeng/p/8032505.html
https://www.tpxhm.com/adetail/551.html
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。