致命错误:在C:\\ Apache Software Foundation \ Apache2.2 \ htdocs \ sample \ testdb.php中找不到类'Mongo' [英] Fatal error: Class 'Mongo' not found in C:\\Apache Software Foundation\Apache2.2\htdocs\sample\testdb.php

查看:58
本文介绍了致命错误:在C:\\ Apache Software Foundation \ Apache2.2 \ htdocs \ sample \ testdb.php中找不到类'Mongo'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

致命错误:

在C:\ Apache中找不到类'Mongo' 软件 Foundation \ Apache2.2 \ htdocs \ sample \ testdb.php

Class 'Mongo' not found in C:\Apache Software Foundation\Apache2.2\htdocs\sample\testdb.php

有人可以帮我解决这个问题吗?为什么这样说呢?

Can anyone help me out with this issue? Why is that saying so?

以下是我使用的代码.我已经在MongoDB中创建了一个名为phptest的数据库,并插入了一个文档.然后,我尝试通过PHP连接到MongoDB,但这引发了此错误.

The following is the code that I have used. I have created a database named phptest in MongoDB and inserted a document. Then I tried connecting to MongoDB via PHP but it threw this error.

有人可以帮我摆脱这个吗?我已经包含了php-mongo dll并也保存在php.ini文件中.

Can anyone help me get rid of this? I have included the php-mongo dll and saved in php.ini file also.

<?php
echo "succeeded!";
$connection = new Mongo();
$db = $connection->test;
$collection = $db->phptest;
?>

推荐答案

确保已安装正确的php驱动程序.

Make sure you have the correct php driver installed.

例如,如果在php.ini中启用了线程安全",则请确保已安装线程安全Mongo扩展",而不是非线程安全"版本.

For example if "Thread Safety" is enabled in your php.ini, then make sure you have the "Thread-Safe Mongo Extension" installed and NOT the "Non-Thread-Safe" version.

这篇关于致命错误:在C:\\ Apache Software Foundation \ Apache2.2 \ htdocs \ sample \ testdb.php中找不到类'Mongo'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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