Ubuntu 26.04, PHP 8.5 and Mongo 2.3 driver

So firstly from the clean 26.04 Ubuntu Desktop install we need to install php8.5

apt install php8.5 php-pear php8.5-dev libzstd-dev

Then we can move on to composer from https://getcomposer.org/download

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c8b085408188070d5f52bcfe4ecfbee5f727afa458b2573b8eaaf77b3419b0bf2768dc67c86944da1544f06fa544fd47') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer


Next we can move on to upgrading the version of MongoDB extension version from what was part of my install as version 2.1.7 up to the current 2.3.2 via the following:

sudo pecl upgrade mongodb

Not knowing what all the various configuration questions mean I left them as the defaults.

Hopefully later point releases of Ubuntu 26.04 will already contain the later drivers. We need 2.2.x or upwards for any vector support.

If the compile completed then do the following :

echo "extension=mongodb.so" | sudo tee /etc/php/8.5/mods-available/mongodb.ini

sudo phpenmod -v 8.5 mongodb

The extension will now be loaded as a module.

Leave a Reply