一、问题的存在
日常报错:
日常解决分析:
日常报错,首先是看日志,这是都是教训总结出来的经验啊...好了,这次是PHP报错,“Redis” not found,要么Redis扩展没装,要么Redis版本不兼容,还要么找不到Redis的默认安装路径。经过排查之后,发现是没装Redis扩展,可能在源码编译的时候,没有加入Redis扩展选项。
备注:其实没装Redis扩展也没什么,也就有一些网页显示不出来,严重的可能认为代码有问题,并不是运维的锅,最后升级发酵变成技术部内讧。当然,一般出错肯定现在自身的原因,找不到再把锅甩一甩,最后肯定能找到“适当”的处理办法。
二、大干一场
1.下载扩展包
链接:https://pan.baidu.com/s/1WHcLFOD0SaaRZlgD50yvWQ 密码:zmto
2.创建放压缩包的目录,并解压
[[email protected] source]# pwd
/server/source
[[email protected] source]# tar -xf 2.2.4.tar.gz
[[email protected] source]# cd
lnmp1.4/ phpredis-2.2.4/
[[email protected] source]# cd phpredis-2.2.4/
[[email protected] phpredis-2.2.4]#
3.使用phpize生成configure配置文件
[[email protected] phpredis-2.2.4]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[[email protected] phpredis-2.2.4]#
4.预编译[[email protected] phpredis-2.2.4]# ./configure --with-php-config=/usr/local/php/bin/php-config
5.编译安装[[email protected] phpredis-2.2.4]# make && make install
6.修改php.ini配置文件,支持redis动态库(重点)
[[email protected] phpredis-2.2.4]# vim /usr/local/php/etc/php.ini
extension="redis.so" #最后一行添加
7.重启PHP服务
[[email protected] phpredis-2.2.4]# lnmp restart
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx... done
Shutting down MySQL.. SUCCESS!
Gracefully shutting down php-fpm . done
Starting LNMP...
Starting nginx... done
Starting MySQL.. SUCCESS!
Starting php-fpm done
[[email protected] phpredis-2.2.4]#
8.搞定,刷新网页,呈现“一幅大好江山”,运维就好好带上安全帽啦(滑稽~)
原文地址:http://blog.51cto.com/leoheng/2162621
时间: 2024-10-05 05:46:55