MongoDB Installation

From DreamFactory
Jump to: navigation, search

Drivers

Bitnami Installs on Windows, Mac, and Linux

Note:The Bitnami packages come with an instance of MongoDB and the drivers already installed. No further action is necessary, unless upgrading from pre 2.1.2 to 2.1.2 or later.

Windows

If you have a Bitnami for Windows stack that has the older mongo driver, but need to upgrade to the mongodb driver, follow this procedure

  • Download the dll from pecl
    • http://pecl.php.net/package/mongodb
    • Click on the DLL link for the latest stable package unless you have a reason to use a different version
    • On the download page you will be presented with multiple options. You need to always choose thread safe and 32 bit (x86). Choose the version that matches the PHP version of your stack (5.5, 5.6, 7.0.)
    • unzip the package after download
  • Copy the php_mongodb.dll file to the extensions directory
    • the PHP extensions default location is
      C:\Bitnami\dreamfactory-{version number}\php\ext\
  • Edit the php.ini file
    • php.ini default location is
      C:\Bitnami\dreamfactory-{version number}\php\
    • add a line that says
      extension=php_mongodb.dll
    • save the php.ini file
  • Restart your Bitnami stack

Manual Install on Linux

Beginning with DreamFactory 2.1.2 the newer mongodb driver is both supported and required. This gives MongoDB compatibility up to the latest version (3.2)

mongo driver

  • used for DF 2.1.1 and earlier
  • Ensure that you have the php-pear and php5-dev packages installed on your system. You will also need the pcre3 and sasl2 development libraries.
    • $ sudo apt-get install php-pear php5-dev libpcre3-dev libsasl2-dev
  • Use PECL to make the mongo.so file
    • $ sudo pecl install mongo
Note:If the the install generates any errors it will fail. You will need to troubleshoot based on the error reported.
  • Add the module to your php.ini file. In debian based distributions, you can follow this procedure:
    • Create a module file for your mongo installation.
    • $ sudo touch /etc/php5/mods-available/mongo.ini
    • Edit the file you just created in your preferred text editor.
There is a single line in the file it looks like this:
      • extension=mongo.so
    • Enable the php extension
      • $ sudo php5enmod mongo
    • Restart your web service service
      • $ sudo service apache2 restart
        or
      • $ sudo service php5-fpm restart && sudo service nginx restart

mongodb driver

Overview These instructions are specific to Debian-based Linuxes, but the principal is the same -- Get the dependencies. Build the .so file with PECL. Add it to your PHP.

  • used for DF 2.1.2 and later
  • Ensure that you have the php-pear and php5-dev packages installed on your system. You will also need the some development libraries (listed below.)
    • $ sudo apt-get install php-pear php5-dev autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev
  • Use PECL to make the mongodb.so file
    • $ sudo pecl install mongodb
Note:If the the install generates any errors it will fail. You will need to troubleshoot based on the error reported.
  • Add the module to your php.ini file. In debian based distributions, you can follow this procedure:
    • Create a module file for your mongo installation.
    • $ sudo touch /etc/php5/mods-available/mongodb.ini
    • Edit the file you just created in your preferred text editor.
There is a single line in the file it looks like this:
      • extension=mongodb.so
    • Enable the php extension
      • $ sudo php5enmod mongodb
    • Restart your web service service
      • $ sudo service apache2 restart
        or
      • $ sudo service php5-fpm restart && sudo service nginx restart