How to install MongoDB Driver PHP for Plesk

How to install MongoDB Driver PHP for Plesk

Published on 2017-11-13 in Development

Installation

For the PLESK environment under UBUNTU, you must first install the development packages for our latest version of PHP. Number 71 corresponds to PHP version 7.1.

apt-get install plesk-php71-dev build-essential

Now, we can install the module mongodb PHP 7.1 with its version PECL.

/opt/plesk/php/7.1/bin/pecl config-set php_prefix /opt/plesk/php/7.1/bin/
/opt/plesk/php/7.1/bin/pecl install mongodb

More information about the procedure with the official documentation of mongodb with PECL.

Configuration

The successful installation, we must now add in the configuration of php.ini. You have to create a file ** mongodb.ini ** in the php.d folder of your PHP version.

echo "extension=mongodb.so" > /opt/plesk/php/7.1/etc/php.d/mongodb.ini

You need to run the php_settings command from PLESK to update the php.ini configuration of your domains.

plesk bin php_settings -u

The article is also available in French