您现在的位置是:首页 > 经验记录>Laravel日记>ubuntu 下搭建redis和php的redis的拓展 网站首页 Laravel日记
ubuntu 下搭建redis和php的redis的拓展
系统环境:
腾讯云服务器, ubuntu16.0.4.4 ,php7.0
一.安装redis服务
sudo apt-get install redis-server
安装好的redis目录在 /etc/redis [也可使用命令whereis redis 查找]
启动:
sudo service redis-server start
然后运行客户端命令redis-cli能够出现命令提示符127.0.0.1:6379: >就算成功了!
二.安装redis 拓展
1.安装redis和php的redis扩展
apt-get install git php-dev //包含了phpize
git clone https://github.com/nicolasff/phpredis.git //克隆phpredis拓展
cd phpredis/
phpize //生成PECL扩展的configure文件
./configure
make //编译
make install //安装
2.配置php的redis扩展
sudo vim /etc/php/7.0/fpm/php.ini 中写入 extension=redis.so
3.重启fpm,访问info.php,就能看到redis扩展
1 | /etc/init.d/php7.0-fpm restart |
4.读取测试
1 2 3 4 5 6 7 8 9 | <?php $redis = new Redis(); //连接redis服务器 $redis ->connect( '127.0.0.1' , '6379' ) or die ( "Could net connect redis server!" );; echo "Connection to server sucessfully ; //查看服务是否运行 echo "Server is running: " . $redis ->ping(); |
参考链接:https://blog.csdn.net/setoy/article/details/77679976
https://blog.csdn.net/caoyouming0609/article/details/78197462
原文地址:https://www.cnblogs.com/xiaotaoing/p/8718278.html
下一篇:phpstorm好用插件集
随机推荐
- laravel-permission使用记录[手册]
- [转载]MySQL根据某一个或者多个字段查找重复数据的sql语句
- ceph三节点基本服务搭建
- Git忽略规则和.gitignore规则不生效的解决办法
- go-colly 使用文档【翻译】
- Laravel软删除操作以及回收站功能实现
- 阿里云 Failed to download metadata for repo ‘AppStream‘(centos8放弃维护)
- Mysql允许远程链接(直接使用navicat走非ssh通道连接)的方法
- 如何将本地未提交更改合并到另一个Git分支中
- CentOS8 yum 报错 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream
文章评论
未开放