• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Driver mongodb in plesk php7.4

arekumaro

New Pleskian
Hi :)

I have a server with Plesk and Centos 7.
I configured a domain to PHP version 7.4 and wanted to add the mongodb extension to it.
Well I ended up installing the mongodb extension to the server by executing: php -r "phpinfo();" mongo appears on the server
MongoDB support => enabled
MongoDB extension version => 1.12.0
MongoDB extension stability => stable
But not when I run phpinfo on a domain php file or /opt/plesk/php/7.4/bin/php -r "phpinfo();".
I have performed the following actions and they have not worked:
1st
yum install plesk-php74-dev make gcc
apt-get install plesk-php71-dev build-essential
2nd
/opt/plesk/php/7.4/bin/pecl install mongodb
3rd
echo "extension=mongodb.so" > /opt/plesk/php/7.4/etc/php.d/mongo.ini
I also tried:
echo "extension=mongodb.so" > /opt/plesk/php/7.4/etc/php.d/mongodb.ini
echo "extension=mongo.so" > /opt/plesk/php/7.4/etc/php.d/mongo.ini
4th
plesk bin php_handler --reread
5th
/opt/plesk/php/7.4/bin/php -m | grep mongo
answer: mongodb
6th
plesk bin php_settings -u
7th
Whenever I finish some test I execute:
/etc/init.d/nginx restart
service httpd restart
I've even tried going to PHP from Plesk and putting the extension in the .ini, it didn't work either.
When executing my php file it tells me:
Fatal error: Uncaught Error: Class 'MongoDB\Driver\Manager' not found
But it's because I can't add the extension.
Please I need your help, thank you.
 

Attachments

  • Captura de pantalla 2022-01-21 a las 9.47.37.png
    Captura de pantalla 2022-01-21 a las 9.47.37.png
    290.2 KB · Views: 4
Try:
Bash:
/opt/plesk/php/7.4/bin/pecl config-set php_prefix /opt/plesk/php/7.4/bin/
/opt/plesk/php/7.4/bin/pecl install mongodb

And add extension=mongodb.so to /opt/plesk/php/7.4/etc/php.ini

Don't forget to run service plesk-php74-fpm restart to restart PHP if you run fpm.
 
Last edited:
Hi Rasp.
[root@ss2 ~]# cd /
[root@ss2 /]# cd /opt/plesk/php/7.0/etc/
-bash: cd: /opt/plesk/php/7.0/etc/: No existe el fichero o el directorio
[root@ss2 /]# service php7.4-fpm restart
Redirecting to /bin/systemctl restart php7.4-fpm.service
Failed to restart php7.4-fpm.service: Unit not found.
[root@ss2 /]#
[root@ss2 /]# cd /opt/plesk/php/
[root@ss2 php]# ls
7.3 7.4

:( :(
 
@arekumaro, sorry I mixed up the version numbers in m'n previous post. I've edited my previous post with the right commands. Try again if you like.
 
Hi Rasp.
I did the steps you told me and it doesn't work.
 

Attachments

  • Captura de pantalla 2022-01-21 a las 12.07.29.png
    Captura de pantalla 2022-01-21 a las 12.07.29.png
    63.3 KB · Views: 9
Did you run ?
Bash:
/opt/plesk/php/7.4/bin/pecl config-set php_prefix /opt/plesk/php/7.4/bin/
/opt/plesk/php/7.4/bin/pecl install mongodb
 
[root@ss2 php.d]# /opt/plesk/php/7.4/bin/pecl config-set php_prefix /opt/plesk/php/7.4/bin/
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /opt/plesk/php/7.4/lib64/php/modules/mongodb.so (/opt/plesk/php/7.4/lib64/php/modules/mongodb.so: cannot open shared object file: No such file or directory), /opt/plesk/php/7.4/lib64/php/modules/mongodb.so.so (/opt/plesk/php/7.4/lib64/php/modules/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

:( :( It gives me an error if I run the first.
 
Remove extension=mongodb.so (or comment out) from /opt/plesk/php/7.4/etc/php.ini, restart PHP, and try to run the other commands again.
 
[root@ss2 php.d]# /opt/plesk/php/7.4/bin/pecl config-set php_prefix /opt/plesk/php/7.4/bin/
config-set succeeded
[root@ss2 php.d]# /opt/plesk/php/7.4/bin/pecl install mongodb
pecl/mongodb is already installed and is the same as the released version 1.12.0
install failed

And add extension=mongodb.so to /opt/plesk/php/7.4/etc/php.ini
Run service plesk-php74-fpm restart to restart PHP if you run fpm.

Nothing at all. :( :(
 
Try uninstalling your current installation of mongodb. Afterwards try again with the commands from my previous post.
Try:
Bash:
/opt/plesk/php/7.4/bin/pecl config-set php_prefix /opt/plesk/php/7.4/bin/
/opt/plesk/php/7.4/bin/pecl install mongodb

And add extension=mongodb.so to /opt/plesk/php/7.4/etc/php.ini

Don't forget to run service plesk-php74-fpm restart to restart PHP if you run fpm.
 
Back
Top