MongoDB

From DreamFactory
Jump to: navigation, search

If you have a Bitnami for Linux VM or Cloud image that has the older mongo driver or a too old version of mongodb driver, and need to upgrade to the mongodb driver, follow this procedure

  • Clone the source
    • You can do this from anywhere that you have write access, but we recommend your user's home folder.
    • git clone https://github.com/mongodb/mongo-php-driver.git
  • Change into cloned repo and get submodules
    • cd mongo-php-driver
    • git submodule sync && git submodule update --init
  • Prepare the build environment for a PHP extension
    • phpize
  • Install the necessary libraries
    • sudo apt-get update && sudo apt-get install libssl-dev libsslcommon2-dev libcurl4-openssl-dev pkg-config
  • Configure the environment
    • ./configure --with-libdir=/lib/x86_64-linux-gnu
  • Compile the module
    • make all -j 5
  • Install the module
    • sudo make install
    • 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
    • sudo vim /opt/bitnami/php/etc/php.ini
    • Add a line indicating the new module. It can go anywhere in the file. I put mine right next to the mongo.so instruction.
      • extension=mongodb.so
    • Save the file and exit
  • Restart the Bitnami stack
  • Verify successful installation using php -m and grep

Example:

bitnami@ubuntu:~/mongo-php-drivers$ php -m | grep mongo
mongo
mongodb