How to install mongodb extension for PHP on Plesk Server
Please login to your respective VPS server and be sure that you are having full root access to the file system. This can be done either by directly login as root or using another switching tools like 'sudo' or 'su'. As for this tutorial, we are going to install mongodb extention to PHP 7.0. If you are about to us a different PHP version. Please change the number 7.0 to respective PHP version.
|1. Before you start, please make sure that extention_dir has been defined inside your php.ini pointing to the correct path. as for example:
extension_dir = "/opt/plesk/php/7.0/lib64/php/modules/"
|2. Now install the latest compiling application dependencies.
yum install gcc openssl-devel plesk-php70-devel
|3. Force the php_suffix to the correct PHP version that you are about to use.
/opt/plesk/php/7.0/bin/pecl config-set php_prefix /opt/plesk/php/7.0/bin/
|4. You will need to use PECL as a tool to installed this extention modules.
/opt/plesk/php/7.0/bin/pecl install mongodb
|5. Once installation has been success. Please browse to /opt/plesk/php/7.0/lib64/php/modules/ and set the correct permission to mongodb.so. Normally we will use 755.
|6. Now you can enable mongodb extention. Please create or edit /opt/plesk/php/7.0/etc/php.d/mongodb.iniand add below into the file.
echo "extension=mongodb.so" > /opt/plesk/php/7.0/etc/php.d/mongodb.ini
Was this answer helpful?