PHPKonf Istanbul PHP Conference 2019 - Call for Papers

Instalación del Controlador de MongoDB para PHP en OSX con Homebrew

Si se utiliza » Homebrew, el tap de PHP incluye fórmulas para instalar el controlador en varias versiones de PHP.

  • php54-mongodb
  • php55-mongodb
  • php56-mongodb
  • php70-mongodb

Por ejemplo, se podría instalar el controlador para PHP 7.0 con el siguiente comando:

$ brew install php70-mongodb

add a note add a note

User Contributed Notes 9 notes

lcalrissian at yahoo dot com
8 months ago
The mongodb install has been removed from Homebrew. To install the mongodb extension you need to use pecl.

sudo pecl install mongodb

You may need to follow some additional configuration. Follow the inline instructions as they appear. Once the install is finished it will add two lines at the bottom of your php.ini file. Instead, remove these lines and add the and add a separate file to your conf.d directory in the same directory as you php.ini file.

In php.ini remove

extension="" // remove
extension=" // remove

Then run:

$ touch /usr/local/etc/php/5.6/conf.d/ext-mongodb.ini

Finally add this line to the new file:

// example
givemeanthony at outlook dot com
2 years ago
You must first tap the PHP formula repository from terminal like so

    brew tap homebrew/php

in order to install PHP extensions like MongoDB via Homebrew.
After tapping the formula repository, install the MongoDB extension

    brew install phpxx-mongodb

where xx is the version number.
okanck at gmail dot com
8 months ago
All formulas in homebrew/php has been deleted or moved to homebrew/core.

To avoid installation problem in homebrew, you can use the command below:

brew tap kyslik/php
brew install phpXX-mongodb
simon at programujem dot eu
1 year ago
The mongodb extension is also available for PHP 7.1, you can install it using similar command:

brew install php71-mongodb
haxpor at gmail dot com
1 year ago
No only just you install it via brew for correct version of php installed on your machine.

You have to set extension in php.ini too.

In case of macOS and php 5.6 installed.
I have to set


The correct path will show mongodb loaded on phpinfo.
cristian dot carreno dot g at gmail dot com
1 year ago
For OS Sierra 10.12.6

PHP 5.6

brew tap homebrew/php
brew install php56-mongodb
amit dot clavax at gmail dot com
2 years ago
Below command work for me mac sierra os
brew install php55-mongodb
8 months ago
Then I try install

brew install php72-mongodb

I get error:

Error: No available formula with the name "php72-mongodb"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
avtrulzz at yahoo dot co dot in
2 years ago
The correct command for installation is using homebrew is
brew install homebrew/php/phpxx-mongodb

For ex. to install the driver for php5.6 use :
brew install homebrew/php/php55-mongodb
To Top