Home > Net >  phpinfo() is not showing me that the mongodb is installed on my mac
phpinfo() is not showing me that the mongodb is installed on my mac

Time:10-05

I just installed the mongodb on my mac pc. If I run this command:

php --ri mongodb

I can see it's successfully installed:

mongodb

MongoDB support => enabled
MongoDB extension version => 1.14.1
MongoDB extension stability => stable
libbson bundled version => 1.22.1
libmongoc bundled version => 1.22.1
libmongoc SSL => enabled
libmongoc SSL library => Secure Transport
libmongoc crypto => enabled
libmongoc crypto library => Common Crypto
libmongoc crypto system profile => disabled
libmongoc SASL => enabled
libmongoc ICU => disabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled
libmongoc compression zstd => enabled
libmongocrypt bundled version => 1.5.2
libmongocrypt crypto => enabled
libmongocrypt crypto library => Common Crypto

Directive => Local Value => Master Value
mongodb.debug => no value => no value

But using the phpinfo() output I can't see it's installed. I also add this:

extension="/usr/local/Cellar/php/8.1.11/pecl/20210902/mongodb.so"

to php.ini file.

Any idea?

CodePudding user response:

PHP via Web and CLI can, and usually do, have their own ini files.

Check the ini file that cli reports to use vs the ini file phpinfo() reports to use.

Chances are they are different and will need to enable modules in both ini files.

CodePudding user response:

As per our discussion , Your server is using different php version then your cli, CLI has installed mongodb in php 8.1 and server is using php 7.4

to change php version MAMP is using please refer to this answer

https://stackoverflow.com/a/44384509/12987235

Or you can use the mamp's php in cli, refer below link to use mamp's PHP https://www.choosepizzi.net/mamp-lets-make-terminal-use-mamps-php-instead-of-macs-version/


  • Related