Problem

We need to install MongoDB drivers for PHP/Apache (Ubuntu LTS 12.04). An error message showed up in apache logs when trying to access MongoDB in the Phalcon framework:

PHP Fatal error: Class 'MongoClient' not found in ...

Analysis

We consider that LAMP and MongoDB is already installed.

Resolution

We need first to install and compile the MongoDB module:

$ sudo pecl search mongo
$ sudo pecl install mongo

If the build process did not set up the php.ini file, do it yourself:

$ sudo cd /etc/php5/apache2/

Finally restart the services:

$ sudo service apache2 restart
$ sudo service mongodb restart

References

Install MongoDB on Ubuntu
Tagged on:         

Leave a Reply