Has anyone successfully installed PHP8.1 with the mongodb.so driver in linux?
I am using Ubuntu 22.04, which is running flawlessly.
1… I have installed mongodb, which works as advertised using the mongosh shell.
2… PHP is installed using the recommended installation process.
3… The mongodb driver is installed through pear(PECL)
4… I have verified that mongodb.so is actually in folder /usr/lib/php/20210902
4… I have added extension=mongodb.so to the php.ini file which is located in /etc/php/8.1/apache2/
5… I have added the extension dir /usr/lib/php/20210902, which isn’t supposed to be necessary, but I did it anyway.
Both of the paths above are exactly the same as reported in phpinfo.php
When I verify my installation using php -m, I get the following error
PHP Startup: Unable to load dynamic library ‘mongodb.so’ (tried: /usr/lib/php7/modules/mongodb.so (/usr/lib/php7/modules/mongodb.so: undefined symbol: ns_parserr), /usr/lib/php7/modules/mongodb.so.so (/usr/lib/php7/modules/mongodb.so.so: cannot open shared object file: No such file or directory))
This is the installation process I have used.
sudo apt install apache2
sudo apt install php
INSTALL MONGODB EXTENSION FOR PHP
sudo apt install php-dev php-pear
sudo apt -y install php-mongodb