Install MongoDB driver for PHP on Ubuntu

Type following line in command line:

sudo pecl install mongo

If Pecl throws this error: configure: error: sasl.h not found! add following command and retry installing mongodb

sudo apt-get install libsasl2-dev

After installing, add the mongo extension to php.ini

extension=mongo.so

Restart apache:

sudo service apache2 restart

See if driver is installed by calling the phpinfo() function.

mongo_phpinfo.png

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.