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

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

问题描述

我已在具有phpredis扩展名的ubuntu 14服务器上安装了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');

在命令行中运行正常,但在Web浏览器中运行不正常.

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

我在Google上度过了几个小时,但没有发现任何有用的信息

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天全站免登陆