Friday, August 12, 2011

Install MongoDB PHP driver on Debian 6 Squeeze

Install the server

apt-get install mongodb-server

Before install the PHP driver a couple of packages you'll need:

apt-get install php5-dev build-essential php-pear

Now time to compile/install the driver:

pecl install mongo

Once it finishes it will display the location of the new extension. Something like:

/usr/lib/php5/20090626/mongo.so

Finally add this to your php.ini (/etc/php5/cgi/php.ini):

extension=/usr/lib/php5/20090626/mongo.so

Now restart your web server and that's should be it!