用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.
為什麼會這樣?
回複內容:
用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.
為什麼會這樣?