laravel5框架下报错Class 'Predis\Client' not found

zhuima
  • 38

故障报错:

2015/12/25 11:16:36 [error] 15155#0: *43 FastCGI sent in stderr:
 "PHP message: PHP Fatal error:  Class 'Predis\Client' not found in
  /var/www/xxxxx/vendor/laravel/framework/src/Illuminate/Redis/Database.php 
  on line 62" while reading response header from upstream, 
  client: 127.0.0.1, server: localhost, request: "POST /xxx/v2/task/cr HTTP/1.1",
   upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:7500"

环境描述:

系统环境:

CentOS release 6.5 (Final)

php版本:

PHP 5.5.28 (cli) (built: Nov 19 2015 12:08:01) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

laravel框架和predis版本

  "require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.1.*",
    "predis/predis": "^1.0",
},

存储:redis实现


redis-cli 2.8.3

supervisor来实现队列

[program:zhuima]
process_name=%(program_name)s_%(process_num)02d
command= php artisan queue:work --sleep=3 --tries=1 --daemon
autostart=true
autorestart=true
user=www
numprocs=8
redirect_stderr=true
stdout_logfile=/tmp/xxx.log

症状出现频率:

刚开始是正常的,使用一会就会出现Class 'Predis\Client' not found的报错,
临时解决方式:重装predis模块解决,但是过一会,时间间隔半个小时左右又会报错

求助php大神帮忙定位下是什么问题?

回复
阅读 16.1k
3 个回答

@eearnpls 正常场景下不会出现这种问题的,出现该故障的机器上环境比较复杂,另外就是机器php的redis扩展和laravel框架的predis模块的方法又冲突导致的,后来标准化环境之后就没出现过这种情况了

composer require predis/predis

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏