I’m beginner trying Mongodb.
I installed Mongodb and localhost:28017/ is working.
When I start service via terminal “/etc/init.d/mongodb start” it works.
But I added test.php file in /var/www/
<?php
$connection = new Mongo();
?>
but I’m getting server error “Server error
The website encountered an error while retrieving localhost/test.php. It may be down for maintenance or configured incorrectly.”.
There’s two parts to MongoDB: the server part, and the client part. The server part does all the real work, but you need to be able to talk to it. Client libraries fill that gap. They abstract the underlying network communication and present a nice API (e.g.,
new Mongo()) to the user. You’ve got the server running; that’s great. You have not, however, installed the client library for PHP, so PHP has no idea what to do withnew Mongo().