惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - 陈达辉

win10安装redis 基于SpringBoot的在线教育系统【源码开源】【建议收藏】 - 陈达辉 eduYouke在线教育点播系统 解决ThinkPHP6 控制器不存在:app\controller\Index - 陈达辉 - 博客园 ubuntu下安装YApi 低版本idea中SpringBoot项目启动失败,提示找不到 javax/servlet/ServletContext类 nginx -s reload 与 service nginx restart 的区别 安装pip install pymysql碰到的问题,升级pip报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vZoYWX/pip/ python 服务器后台运行 Git冲突:commit your changes or stash them before you can merge. 解决办法 安装node、vue相关问题 初学JAVA-10-java代码的组织结构 IntelliJ IDEA 2020.2 破解版(附永久破解激活方法)Java开发者必备的神器 laravel观察者模式使用及注意事项 本地连接虚拟机redis,解决redis connection refused: connect问题 linux如何删除php7 使用vscode开发php nginx: [emerg] open() "/etc/nginx/fastcgi.conf" failed Ubuntu16.04安装Redis
ubuntu php7.2安装php-redis扩展
陈达辉 · 2021-01-13 · via 博客园 - 陈达辉

安装phpize

首先查看有没有phpize命令

[xstnet~]$ phpize -v
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

如果没有phpize的话, 安装php-dev扩展, 执行

sudo apt-get install php7.2-dev

我的php版本是php7.2
根据php版本,选择以下之一

  • php-dev
  • php5-dev
  • php5.6-dev
  • php7.0-dev
  • php7.1-dev
  • php7.2-dev

不管选择哪个版本, 最后都会有phpize这个命令

下载phpredis源码包

git clone https://github.com/phpredis/phpredis.git

移动目录

编译安装

cd /etc/phpredis
phpize
./configure
sudo make
sudo make install

至此扩展就安装完成了

修改php配置文件

找到php.ini
通过php -i | grep php.ini或者在代码中echo phpinfo()来获取php.ini位置
在php.ini中添加一行

extension=/etc/phpredis/modules/redis.so

保存退出, 重启 php-fpm, 重启nginx

systemctl restart php7.2-fpm
systemctl restart nginx

如下图:

验证是否安装成功

代码中 输出 phpinfo() 结果应如下
alt