致命错误:找不到“Redis"类 [英] Fatal error: Class 'Redis' not found

查看:67
本文介绍了致命错误:找不到“Redis"类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的 ubuntu 14 服务器上安装了带有 phpredis 扩展的 Redis.我使用 Nginx 服务器.我有php测试脚本

I've installed Redis on my ubuntu 14 server with phpredis extension. Im using Nginx server. I have php testing script

$redis=new Redis() or die("Cannot load Redis module.");
$redis->connect('localhost');
$redis->set('random', rand(5000,6000));
echo $redis->get('random');

在命令行中运行良好,但在网络浏览器中运行不正常.

which is working fine from command-line but not from web browser.

Nginx 错误日志:

Nginx error log:

[info] 31102#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:82
[error] 31108#0: *21 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'Redis' not found in...

即使在 phpinfo()

全部通过 apt-get install 安装

all installed with apt-get install

所有其他模块(mysql、imagemagick...)都工作正常

all other modules (mysql, imagemagick...) are working fine

我在谷歌上花了几个小时,但没有发现任何有用的东西

i've spent few hours on google but haven't found nothing useful

推荐答案

您已经安装了 redis 但没有安装 php-redis.你可以简单地运行下面的命令来安装 php-redis

You have installed redis but not php-redis. you can simply run the command below to install php-redis

sudo apt-get install php-redis

这篇关于致命错误:找不到“Redis"类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆