致命错误-' Mongo'找不到课程 [英] Fatal Error - 'Mongo' class not found

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

问题描述

我正在尝试执行此操作

<?php

// connect
$m = new Mongo();

?>

但是出现以下错误:

致命错误:在C:\ wamp \ www ......

中找不到类'Mongo'


信息:

  • PHP:5.38
  • MongoDB:mongodb-win32-i386-2.0.2
  • MongoDB PHP驱动程序:mongo-1.1.4-php5.3vc6ts
  • WampServer:2.2
  • 操作系统:Windows 7 Enterprise SP1

我已经很好地遵循了MongoDB的安装要求(包括将DLL添加到ext& php.ini中),我已经启动了mongod.exe,WAMP正在运行.

这意味着缺少/不正确是什么?


我让它在另一台Windows 7计算机(Windows 7 Professional)上运行.那让我感到好奇.因此,现在我的Windows 7 Enterprise SP1计算机与Win7 Professional计算机具有相同的http.confphp.iniC:\wamp\bin\mongodb内容(因此DB是完全相同的)和完全相同的批处理文件以启动mongod.exe. >

但是,我在Win7 Enterprise SP1计算机上所能做的就是通过命令行连接.我的Win7 Professional计算机的phpinfo()包含:
我的Win7 Enterprise SP1计算机没有任何对MongoDB的引用.

我用来启动MongoDB的批处理文件的内容:

"C:\wamp\bin\mongodb\bin\mongod.exe" --logpath "C:\wamp\bin\mongodb\logs\error.log" --logappend --dbpath "C:\wamp\bin\mongodb\data\db" --directoryperdb --service
Net Start "MongoDB"
pause

解决方案

问题出在PHP驱动程序(php_mongo.dll).由于某些原因,Apache/WAMP只是不喜欢mongo-1.1.4-php5.3vc6ts版本.我的Windows 7 Professional计算机具有mongo-1.2.5-php5.3vc9ts版本.那是两台机器之间的唯一区别.

我最初是在Windows 7 Enterprise计算机上使用驱动程序的mongo-1.2.5-php5.3vc9ts版本,但是在对问题进行故障排除时更改为mongo-1.1.4-php5.3vc6ts版本.因此,最初的问题实际上可能只是数据库路径data\db不存在/找不到(并且在运行/启动mongod.exe时需要使用--dbpath指定).

I'm trying to execute this:

<?php

// connect
$m = new Mongo();

?>

But I get the following error:

Fatal error: Class 'Mongo' not found in C:\wamp\www.....


Info:

  • PHP: 5.38
  • MongoDB: mongodb-win32-i386-2.0.2
  • MongoDB PHP Driver: mongo-1.1.4-php5.3vc6ts
  • WampServer: 2.2
  • OS: Windows 7 Enterprise SP1

I've followed the MongoDB installation fine (incl. adding the DLL to ext & php.ini), I've started mongod.exe and WAMP is running.

What does this imply is missing/incorrect?


Edit:

I have got it running on another Windows 7 machine (Windows 7 Profressional). That got me curious. So now my Windows 7 Enterprise SP1 machine has the same http.conf, php.ini, C:\wamp\bin\mongodb contents (therefore DBs are the exact same) and the exact same batch file to start mongod.exe as my Win7 Professional machine.

But still, all I can do on my Win7 Enterprise SP1 machine is connect via command line. My Win7 Professional machine's phpinfo() contains:
My Win7 Enterprise SP1 machine doesn't contain any reference to MongoDB.

The contents of the batch file I use to start MongoDB:

"C:\wamp\bin\mongodb\bin\mongod.exe" --logpath "C:\wamp\bin\mongodb\logs\error.log" --logappend --dbpath "C:\wamp\bin\mongodb\data\db" --directoryperdb --service
Net Start "MongoDB"
pause

解决方案

The problem was the PHP driver (php_mongo.dll). Apache/WAMP just did not like the mongo-1.1.4-php5.3vc6ts version for some reason. My Windows 7 Professional machine had the mongo-1.2.5-php5.3vc9ts version. That was the only difference between the two machines.

I originally had been using the mongo-1.2.5-php5.3vc9ts version of the driver on the Windows 7 Enterprise machine but changed to the mongo-1.1.4-php5.3vc6tsversion when I was troubleshooting the problem. So the original problem could actually just have been that the database path data\db didn't exist/couldn't be found (and needed to be specified using --dbpath when running/starting mongod.exe).

这篇关于致命错误-&amp;#39; Mongo&#39;找不到课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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