php安装redis扩展,以及遇到的坑

先说问题吧
php 安装redis扩展ext/standard/php_smart_str.h: No such file or directory
按照网上的教程安装了redis的扩展,执行到 编译安装 make && make install 时,报出了这样的错误,是因为扩展不支持php7,需要我们在 github 上拉 php7 的 redis扩展

git clone https://github.com/phpredis/phpredis.git
cd phpredis
git checkout php7
phpize
./configure
//有时需要加上php-config
./configure --with-php-config=/usr/bin/php-config
make && make install
//查看php扩展,添加了redis
php -m |less

在项目中使用到 redis 时 redis 报错 NOAUTH Authentication required
修改redis的配置文件关于密码的设置

#requirepass foobared
注释掉密码或者重新设置密码
重启redis
ps -ef | grep redis
kill pid 

一般到这步问题就基本解决了,我在配置的时候,可能是因为没有重启成功 redis 或者在是否使用密码的控制上,服务器和代码方并没有同步,浪费了很长时间

猜你喜欢

转载自blog.csdn.net/X_hazel/article/details/82748491