mysql - php连接MongoDB总是失败,为什么?

WBOY
發布: 2016-06-06 20:11:59
原創
1871 人瀏覽過

mysql - php连接MongoDB总是失败,为什么?

用db.getMongo();得到的是:127.0.0.1

浏览器中访问:http://127.0.0.1:27017/
得到的是:It looks like you are trying to access MongoDB over HTTP on the native driver port.

但执行下面的代码:
// 连接到mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// 选择一个数据库
$db = $m->mydb;
echo "Database mydb selected";
?>

结果是:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@phpStudy.net to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

为什么会这样?

回复内容:

mysql - php连接MongoDB总是失败,为什么?

用db.getMongo();得到的是:127.0.0.1

浏览器中访问:http://127.0.0.1:27017/
得到的是:It looks like you are trying to access MongoDB over HTTP on the native driver port.

但执行下面的代码:
// 连接到mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// 选择一个数据库
$db = $m->mydb;
echo "Database mydb selected";
?>

结果是:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@phpStudy.net to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

为什么会这样?

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板