简体   繁体   English

尝试在 Elastic Beanstalk Amazon Linux 中安装 MongoDB PHP 驱动程序

[英]Trying to install MongoDB PHP Driver in Elastic Beanstalk Amazon Linux

Trying to install MongoDB PHP Driver in Elastic Beanstalk running Amazon Linux.尝试在运行 Amazon Linux 的 Elastic Beanstalk 中安装 MongoDB PHP 驱动程序。 Have already created a config file in the .ebextensions folder with the following code:已经在 .ebextensions 文件夹中创建了一个配置文件,代码如下:

container_commands:
  01installMongoExtension:
    command: 'printf "\n" | pecl install -f mongo'
    ignoreErrors: true

Getting an error of:得到以下错误:

Application deployment failed at 2018-11-06T20:01:32Z with exit status 2 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed.

with the following:具有以下内容:

Problem 1
- Installation request for alcaeus/mongo-php-adapter 1.1.3 -> satisfiable by alcaeus/mongo-php-adapter[1.1.3].
- alcaeus/mongo-php-adapter 1.1.3 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
Problem 2
- Installation request for mongodb/mongodb 1.1.2 -> satisfiable by mongodb/mongodb[1.1.2].
- mongodb/mongodb 1.1.2 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
Problem 3
- alcaeus/mongo-php-adapter 1.1.3 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
- doctrine/mongodb 1.6.0 requires ext-mongo ^1.6.7 -> satisfiable by alcaeus/mongo-php-adapter[1.1.3].
- Installation request for doctrine/mongodb 1.6.0 -> satisfiable by doctrine/mongodb[1.6.0].

Not sure where to go from here, seeing as the config file should install the driver...不知道从哪里开始,看到配置文件应该安装驱动程序......

Would like to add that I see the files from the repo that Jenkins builds the app within the /var/app/ondeck/ directory.想补充一点,我看到 Jenkins 在/var/app/ondeck/目录中构建应用程序的 repo 文件。

See here: https://codinglatte.com/posts/php/php-7-with-mongodb-to-elastic-beanstalk/见这里: https : //codinglatte.com/posts/php/php-7-with-mongodb-to-elastic-beanstalk/

You need to use pecl7 instead of pecl您需要使用pecl7而不是pecl

After lot of research I found working solution for for php 7+经过大量研究,我找到了适用于 php 7+ 的解决方案

commands:
 01installMongoExtension:
  command:  /usr/bin/yes 'no'| /usr/bin/pecl7 install mongodb
  test: '! /usr/bin/pecl7 info mongodb'

create .ebextensions folder on root.在 root 上创建 .ebextensions 文件夹。 Inside that folder create php7-mongodb-driver.config file and paste above code in that.在该文件夹中创建 php7-mongodb-driver.config 文件并将上面的代码粘贴到其中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM