mongodbamazon-web-serviceslaravel-4jenssegers-mongodb

How to install MongoDB on amazon linux and connect it to Laravel-jenssegers MongoDB?


I followed this for installing mongodb on Amazon Linux. I have a laravel project to host on my amazon Linux server. Jenssegers mongoDB is already installed in the framework while developing the web app (in Ubuntu).

The web app was developed in Ubuntu 12.04 LTS, and it was working properly.

When I hosted it on the server I am getting error:

Class 'MongoClient' not found

My questions are 1. How can I configure mongodb on amazon linux?

(now when i do sudo service mongod restart it is showing FAILED)

2.What all are the configurations that must be changed in the web app(which is done in Ubuntu) in order to use mongodb?

I am using PHP54

httpd 24

Laravel 4.2


Solution

  • Mongo client is not included in the base PHP API. Instead it needs to be installed as extension.

    Its not part of the base repository, but it is part of EPEL which can be enabled on Amazon Linux. You can also install it via pecl (Provided you have installed the tools to compile extensions). Use one of the two commands to install the extension:

    yum install php-pecl-mongo --enablerepo=epel

    OR

    pecl install mongo

    Once the installation is complete, restart apache and/or php.