MongoDB Installation

From DreamFactory
Jump to: navigation, search
(Drivers)
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
==Drivers==
 
==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. Please consult Bitnami's documentation for adding additional php modules.
 
  
====Windows====
+
===Manual Install on Linux===
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
+
==== Requirements ====
*'''Download the dll from pecl'''
+
* You will need the following items from your package manager (linux)
**http://pecl.php.net/package/mongodb
+
** PHP Pear and PHP Dev (for PECL)
**Click on the DLL link for the latest stable package unless you have a reason to use a different version
+
** Development tools / (e.g. Build Essential tools)
**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.)
+
** libsslcommon2-dev
**unzip the package after download
+
** libssl-dev
*'''Copy the php_mongodb.dll file to the extensions directory'''
+
** libcurl4-openssl-dev
**the PHP extensions directory will be located (by default) at <source lang=bash>C:\Bitnami\dreamfactory-{version number}\php\ext\</source>
+
** pkg-config
*'''Edit the php.ini file'''
+
**php.ini is located (by default) at <source lang=bash>C:\Bitnami\dreamfactory-{version number}\php\</source>
+
**add a line that says <source lang=bash>extension=php_mongodb.dll</source>
+
**save the php.ini file
+
*Restart your Bitnami stack
+
  
===Linux===
+
===Manual Install on Mac Sierra +===
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)
+
* You will need to remove Mongo if brew installed as it had been deprecated: https://gist.github.com/katychuang/10439243
 +
* Install Mongo drivers: https://github.com/mongodb/mongo-php-driver
 +
* You will need to use PECL to build MongoDB: https://pecl.php.net/package/mongodb/1.5.2
  
====mongo driver====
+
==== Driver Install ====
* '''used for DF 2.1.1 and earlier'''
+
* In Linux you will need to use PECL to build the mongodb module and then enable in php.
* '''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.'''
+
**<source lang=bash>$ sudo apt-get install php-pear php5-dev libpcre3-dev libsasl2-dev</source>
+
* '''Use PECL to make the mongo.so file'''
+
**<source lang=bash>$ sudo pecl install mongo</source>
+
::'''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.'''
+
**<source lang=bash>$ sudo touch /etc/php5/mods-available/mongo.ini</source>
+
** '''Edit the file you just created in your preferred text editor.'''
+
::There is a single line in the file it looks like this:
+
***<source lang=bash>extension=mongo.so</source>
+
** '''Enable the php extension'''
+
***<source lang=bash>$ sudo php5enmod mongo</source>
+
** '''Restart your web service service'''
+
***<source lang=bash>$ sudo service apache2 restart</source>  or
+
***<source lang=bash>$ sudo service php5-fpm restart && sudo service nginx restart</source>
+
  
====mongodb driver====
+
For concrete examples, see the [[../../../APT/Ubuntu_16.04/Modules/MongoDB_Ubuntu_16| Ubuntu 16.04]] instructions.
* '''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.)'''
+
**<source lang=bash>$ sudo apt-get install php-pear php5-dev autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev libpcre3-dev</source>
+
* '''Use PECL to make the mongodb.so file'''
+
**<source lang=bash>$ sudo pecl install mongodb</source>
+
::'''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.'''
+
**<source lang=bash>$ sudo touch /etc/php5/mods-available/mongodb.ini</source>
+
** '''Edit the file you just created in your preferred text editor.'''
+
::There is a single line in the file it looks like this:
+
***<source lang=bash>extension=mongodb.so</source>
+
** '''Enable the php extension'''
+
***<source lang=bash>$ sudo php5enmod mongodb</source>
+
** '''Restart your web service service'''
+
***<source lang=bash>$ sudo service apache2 restart</source>  or
+
***<source lang=bash>$ sudo service php5-fpm restart && sudo service nginx restart</source>
+

Latest revision as of 05:18, 12 July 2022

Drivers

Manual Install on Linux

Requirements

  • You will need the following items from your package manager (linux)
    • PHP Pear and PHP Dev (for PECL)
    • Development tools / (e.g. Build Essential tools)
    • libsslcommon2-dev
    • libssl-dev
    • libcurl4-openssl-dev
    • pkg-config

Manual Install on Mac Sierra +

Driver Install

  • In Linux you will need to use PECL to build the mongodb module and then enable in php.

For concrete examples, see the Ubuntu 16.04 instructions.