PHP致命错误:找不到类'MongoDate' [英] PHP Fatal error: Class 'MongoDate' not found
问题描述
我使用锂电池控制台(lithium/console/li3)运行一些命令,但出现此错误:
I use lithium console (lithium/console/li3) to run some command and I get this error:
PHP Fatal error: Class 'MongoDate' not found
我的系统详细信息:
- mongodb服务器:2.6.1
- php mongodb客户端:1.5.2
- Apache 2.4.7
- php 5.5.9-1ubuntu4
$Requests = Requests::find('all', array('conditions'=>array(
'expired'=>array('<'=>new \MongoDate(time())),
'processed'=>0
)));
$Requests = Requests::find('all', array('conditions'=>array(
'expired'=>array('<'=>new \MongoDate(time())),
'processed'=>0
)));
在较旧版本的系统中运行此代码时,我没有此错误
I don't have this error while running this code in older version system
- PHP版本5.3.10-1ubuntu3.11
- Apache/2.2.22(Ubuntu)服务器
- mongodb客户端:1.4.5
- mongodb服务器:2.4.10
谢谢.
另一件事:我尝试创建一个简单的脚本
One more thing: I try to create just a simple script
$date = new MongoDate();
它通过网络服务器(浏览器)运行没有问题,但是如果我使用php命令运行此文件,则会收到相同的错误:Class 'MongoDate' not found
因此,我认为这是php命令的问题.
it runs without problem via webserver (browser) but if I use php command to run this file, I get the same error: Class 'MongoDate' not found
So I believe that it's php command problem.
推荐答案
确保已加载mongodb
扩展名.
var_dump(extension_loaded('mongodb'));
如果没有,则必须将其加载到php.ini
.
If not, you must load it in php.ini
.
这篇关于PHP致命错误:找不到类'MongoDate'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!