用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.
但执行下面的代码:
php
// 连接到mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// 选择一个数据库
$db = $m->mydb;
echo "Database mydb selected";
?>
结果是:
Internal Server Error
立即学习“PHP免费学习笔记(深入)”;
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.
为什么会这样?
用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
立即学习“PHP免费学习笔记(深入)”;
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怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号