• pecl install mongodb或者安装指定版本pecl install https://pecl.php.net/get/mongodb-1.12.1.tgz
  • docker-php-ext-enable mongodb

请求mongo报错 The SCRAM_SHA_1 authentication mechanism requires libmongoc built with ENABLE_SSL,原因在没有开启容器的ssl,因此需要装ssl相关的依赖。

其中开启容器内ssl的问题,先运行apt-get update可能会遇到如下的报错:

N: Repository 'http://mirrors.linode.com/debian buster InRelease' changed its 'Version' value from '10.8' to '10.10'
E: Repository 'http://mirrors.linode.com/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
E: Repository 'http://mirrors.linode.com/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
E: Repository 'http://mirrors.linode.com/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

解决办法是加个参数:sudo apt-get update --allow-releaseinfo-change

再运行apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev应该就可以了。

标签: none

评论已关闭