Reputation: 13
I installed php-mongodb with brew, but when I tried to connect it says no plugin.
echo extension_loaded("mongo") ? "loaded\n" : "not loaded\n";
output : not loaded
The steps I followed: this link
$ brew tap homebrew/homebrew-php
$ brew install php70-mongodb
$ sudo brew services restart httpd
my php versiyon :
$ php -v
output :
PHP 7.0.27 (cli) (built: Feb 15 2018 16:59:02) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
Upvotes: 1
Views: 7361
Reputation: 184
Try to install using MacPorts. it's better than homebrew
it worked fine to me with no problem in my php 7.1:
sudo port install php71-mongodb
if you have other version than 7.1. check this page:
https://www.macports.org/ports.php?by=name&substr=mongodb
Upvotes: 2
Reputation: 94
They removed the tap homebrew/homebrew-php so you need to install it trouguh pecl, first make sure you have pecl installed and working properly.
After that run:
sudo pecl install mongodb
Check if the extension is enabled with:
php -i | grep mongo
You should get an output like:
mongodb
libmongoc bun
dled version => 1.9.4
libmongoc SSL => enabled
...
If you don't get that output, you should check your php.ini and add this line to your php.ini
extension="mongodb.so"
Upvotes: 7
Reputation: 156
I'm using php72 with php72-mongodb on macos. I've installed like following:
brew install php72 php72-mongodb
And then everything is OK when I've restarted my httpd/apache or nginx server.
You can check your setup with:
php -i | grep mongodb
You'll see something likes that following in my opinion:
/usr/local/etc/php/7.2/conf.d/ext-mongodb.ini,
mongodb
mongodb.debug => no value => no value
Upvotes: 0