Not Just Paranoid

Another site by Pete Maynard

Install Mongo DB on Debian with PHP support

Steps to Install MongoDB - This should work with Debian and Ubuntu, with the upstart init system.

sudo apt-key adv --keyserver --recv 7F0CEB10 &&
sudo sh -c 'echo ''deb dist 10gen'' > /etc/apt/sources.list.d/10gen.list' &&
sudo apt-get update &&
sudo apt-get install mongodb-10gen;

If all goes well you should have a fully working MongoDB. To make sure things are working have a look at /etc/var/log/mongodb/mongodb.log

Try it out with:

> { a: 1 } )
> db.test.find()
{ "_id" : ObjectId("5028ef81799a8e44dd0cd654"), "a" : 1 }
{ "_id" : ObjectId("5028f2b13579fd22f1b63d91"), "a" : 1 }

Now go have a look at a nice Tutorial for MongoDB

MongoDB and PHP

We need to install the MongoDB driver for PHP before they can communicate.

sudo apt-get install php5-dev php5-cli php-pear && # Get pecl working.
sudo pecl install mongo # Install the PHP Mongo Driver.

Now show PHP the extension by adding to your php.ini and restart your web server.

MongoDB extension as seen from phpinfo() MongoDB extension as seen from phpinfo()


13 Aug 2012 | Tags ( apt-get bash Databse debian Linux MongoDB PHP Ubuntu )

Website Last Updated on 13 Oct 2020 (CC BY-SA 4.0)

This site uses JQuery and nanogallery2 hosted by
for the Flickr photo feed and GoatCounter for user insights.