我已经从pecl安装了mongo
pecl install mongo
pecl install mongodb
已添加两者
extension=mongo
和php.ini中的extension=mongodb
。
php -v
给出了
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
,而
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警告:未知:依赖系统的时区设置是不安全的。您需要使用date.timezone设置或date_default_timezone_set()函数。如果您使用了这些方法中的任何一种并且仍然收到此警告,则很可能拼错了时区标识符。我们选择了时区' UTC'目前,请设置date.timezone以选择您的时区。在第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
答案 0 :(得分:0)
我也面临同样的问题。我认为mongo驱动程序存在一些问题。 尝试在php.ini中提供mongo.so文件的绝对路径并重新启动服务器
extension="/usr/local/Cellar/php56/5.6.30_6/lib/php/extensions/no-debug-non-zts-20131226/mongo.so"