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.

cd /opt/plesk/php/7.0/lib64/php/modules/
chmod 755 mongodb.so
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?

Also Read

How to access Stack Server instance?

Issue:You are able to see that your subscribe instance status shows running and by clicking on...

PHP Warning: PHP Startup: modulename: Unable to initialize module

You find a lot of errors inside your error_log for your httpd server which stating PHP Warning:...

PHP modules extension has been install successfully, but not listed inside phpinfo

You have follow How to install mongodb extension for PHP on Plesk Server and able to install the...

How to check which application is consuming process

if you found out the server is higly loaded and not able to access throug cpanel but still able...

Specific DNS server for VPS and Dedicated servers

Below are the DNS servers that can be use by servers who are hosted inside our network. IPv4...