Update MongoDB PHP Extension on macOS

AUGUST 28, 2022

Here's how to upgrade to a new version of PHP's Mongo extension if you previously installed it but you've upgraded to the latest PHP version. (If you haven't, see how to install it.)

Uninstall the existing mongodb extension.

sudo pecl uninstall MongoDB
# Extension mongodb disabled in php.ini
# uninstall ok: channel://

Then follow this guide to install it again for the latest PHP version.