Install MongoDB in Ubuntu 12.04 with PHP driver

Install MongoDB:

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

Install MongoDB PHP driver:

sudo apt-get install php-pear php5-dev
sudo pecl search mongo
sudo pecl install mongo

Configure MongoDB PHP driver: Create a file called /etc/php5/mods-available/mongo.ini with this content:

And create a symlink to it in /etc/php5/conf.d/:

cd /etc/php5/conf.d
sudo ln -s ../mods-available/mongo.ini 20-mongo.ini

If the folder mods-available does not exists, create the mongo.ini file in /etc/php5/conf.d/.

Then restart Apache:

sudo service apache2 restart

Start, stop and restart MongoDB:

sudo service mongodb start
sudo service mongodb stop
sudo service mongodb restart

Configuration file:


Log file:


Data files:



You might also like

Install script for XBMC in Raspbian
# Install XBMC sudo sh -c "echo 'deb wheezy contrib' > /etc/apt/sources.list.d/mene.list" sudo...
Solve “mongodb cannot be built while v8 is active” in MacPorts
While updating all the ports of macports I got this error: ---> Configuring mongodb Error: mongodb...
MongoDB: Recover Data after an Unexpected Shutdown in Ubuntu
If you try to run mongod but it fails to start and have this error in the log file (/var/log/mongodb/mongodb.log)...
Install and configure MongoDB and PHP driver with MacPorts
Installing and configuring MongoDB with MacPorts Installing MongoDB with MacPorts is as easy as...
Leave a comment ?


Leave a Comment