Mongodb Driver fail to load in php

My server is Ubuntu 20.4.

I ran:

  • sudo pecl install mongodb

Then i add extension=mongodb.so in /etc/php/7.4/fpm/php.ini

Restart and still I can’t load it in php. Anyone can enlighten me?

Now I know why.

mongodb.so is in /usr/lib/php/20200930 while hestiacp out form the box using /usr/lib/php/20190902 even I tried to copy mongodb.so to 20190902, still no hope because of different API

Module compiled with module API=20200930
PHP    compiled with module API=20190902 

Not sure how to fix this

20200930 is probally for php 8.0 by default we use 7.4 Make sure you use php 7.4 module

I use default 7.4. However to solve this issue, I enabled php8 in Hestiacp, change the site to use php8 and it work.

Try

pecl -d php_suffix=7.4 install <package>

Thanks @eris. It work. Will note the solution for future reference.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.