Search code examples
phpmongodbapacheinstallationmacos-sierra

Can't find mongo in phpmyinfo(); OSX


I have installed mongo from pecl

pecl install mongo
pecl install mongodb

Have added both extension=mongo and extension=mongodb in php.ini.

php -v gives

PHP 5.6.30 (cli) (built: Apr 3 2017 01:13:54) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

whereas php -i | grep mongo

/usr/local/etc/php/5.6/conf.d/ext-mongo.ini, /usr/local/etc/php/5.6/conf.d/ext-mongodb.ini

PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0

mongo
mongo.allow_empty_keys => 0 => 0
mongo.chunk_size => 261120 => 261120
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.is_master_interval => 15 => 15
mongo.long_as_object => 0 => 0
mongo.native_long => 1 => 1
mongo.ping_interval => 5 => 5

mongodb
libmongoc bundled version => 1.5.5
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => enabled
mongodb.debug => no value => no value
PWD => /usr/local/opt/php56-mongo
_SERVER["PWD"] => /usr/local/opt/php56-mongo

Solution

  • I am also facing the same problem. I think there is some problem with the mongo driver. Try giving the absolute path to mongo.so file in php.ini and restart your server

    extension="/usr/local/Cellar/php56/5.6.30_6/lib/php/extensions/no-debug-non-zts-20131226/mongo.so"