2.8.16. Working with mongodb

Important points:

  • MongoDB databases are available as separate service. The mongodb extension can also be used to work with external databases.
  • The mongodb extension is available on PHP 5.4 and higher. On versions PHP 5.4 and 5.5, the correct operation of the extension is not guaranteed, since only an outdated extension exists for them — version 1.2.11 is installed for PHP 5.4, version 1.6.0 for PHP 5.5.
  • To work with MongoDB you need install library.
  1. Openup PHP settings.
  2. Turnon "mongodb" in the block "Modules" and save your changes.
  3. Wait 10-15 minutes for the changes to take effect.
  1. Connect to hosting via SSH.
  2. Change to the desired directory:
    cd ~/example.com/www/

    In the team instead of example.com/www/ specify the path to the desired directory.

  3. Install the extension using inifile site:
    php -c ~/.system/php/www.example.com.ini -f /usr/local/bin/composer require mongodb/mongodb

    Instead www.example.com indicate the site for which switchedon mongodb module.

Content