|
|
(4 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.
| |
| | | |
− | ====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 default location is <source lang=bash>C:\Bitnami\dreamfactory-{version number}\php\ext\</source> | + | ** pkg-config |
− | *'''Edit the php.ini file''' | + | |
− | **php.ini default location is <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'''
| + | |
| | | |
| + | ===Manual Install on Mac Sierra +=== |
| + | * 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 |
| | | |
− | ====Linux VM and Cloud Images==== | + | ==== Driver Install ==== |
− | If you have a Bitnami for Linux VM or Cloud image that has the older mongo driver, but need to upgrade to the mongodb driver, follow this procedure
| + | * In Linux you will need to use PECL to build the mongodb module and then enable in php. |
− | *'''Clone the source'''
| + | |
− | **You can do this from anywhere that you have write access, but we recommend your user's home folder.
| + | |
− | **<source lang=bash>git clone https://github.com/mongodb/mongo-php-driver.git</source>
| + | |
− | *'''Change into cloned repo and get submodules'''
| + | |
− | **<source lang=bash>cd mongo-php-driver</source>
| + | |
− | **<source lang=bash>git submodule sync && git submodule update --init</source>
| + | |
− | *'''Prepare the build environment for a PHP extension'''
| + | |
− | **<source lang=bash>phpize</source>
| + | |
− | *'''Install the necessary libraries'''
| + | |
− | **<source lang=bash>sudo apt-get update && sudo apt-get install libssl-dev libsslcommon2-dev libcurl4-openssl-dev pkg-config</source>
| + | |
− | *'''Configure the environment'''
| + | |
− | **<source lang=bash>./configure --with-libdir=/lib/x86_64-linux-gnu</source>
| + | |
− | *'''Compile the module'''
| + | |
− | **<source lang=bash>make all -j 5</source>
| + | |
− | *'''Install the module'''
| + | |
− | **<source lang=bash>sudo make install</source>
| + | |
− | **You should get output indicating that the module was installed to an extensions directory, for example /opt/binamit/php/lib/php/extensions/
| + | |
− | *'''Edit php.ini'''
| + | |
− | **Use your text editor of choice to edit /opt/bitnami/php/etc/php.ini . I like vim
| + | |
− | **<source lang=bash>sudo vim /opt/bitnami/php/etc/php.ini</source>
| + | |
− | **Add a line indicating the new module. It can go anywhere in the file. I put mine right next to the mongo.so instruction.
| + | |
− | ***<source lang=bash>extension=mongodb.so</source>
| + | |
− | **Save the file and exit
| + | |
− | *'''Restart the Bitnami stack'''
| + | |
− | *'''Verify successful installation using php -m and grep'''
| + | |
− | Example:
| + | |
− | <source lang=bash>bitnami@ubuntu:~/mongo-php-drivers$ php -m | grep mongo
| + | |
− | mongo
| + | |
− | mongodb</source>
| + | |
| | | |
− | ===Manual Install on Linux===
| + | For concrete examples, see the [[../../../APT/Ubuntu_16.04/Modules/MongoDB_Ubuntu_16| Ubuntu 16.04]] instructions. |
− | * The version of php-mongodb in the APT repositories is no longer high enough to satisfy the requirements of the mongodb repos used. Please install using PECL.
| + | |
− | # Make sure you have all the required packages
| + | |
− | #* <source lang="bash">$ sudo apt-get install php-dev php-pear build-essential libsslcommon2-dev libssl-dev libcurl4-openssl-dev pkg-config</source>
| + | |
− | # Install from PECL
| + | |
− | #* <source lang="bash">$ sudo pecl install mongodb</source>
| + | |
− | # Create the ini file
| + | |
− | #* <source lang="bash">$ sudo sh -c 'echo "extension=mongodb.so" > /etc/php/7.0/mods-available/mongodb.ini'</source>
| + | |
− | # Enable the extension
| + | |
− | #* <source lang="bash">$ sudo phpenmod mongodb</source>
| + | |
− | # Restart your webserver app and/or php-fpm
| + | |