在 AWS 上自定义 EC2 实例 php.ini 文件时出错

goo*_*ose 1 php amazon-web-services elastic-beanstalk

我在 AWS 上使用 Elastic Beanstalk,我试图覆盖 php.ini 文件中的一些设置。我已经在目录 /.ebextensions 中创建了 project.config :

files:
  "/etc/php.d/project.ini" :
  mode: "000644"
  owner: ec2-user
  group: ec2-user
  content: |
    date.timezone = "Europe/Berlin"
    error_reporting = E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING
    display_errors = Off
Run Code Online (Sandbox Code Playgroud)

当我重新部署应用程序时,EBS 抛出以下错误:

The configuration file __MACOSX/gf/.ebextensions/._project.config in application version gf3 contains invalid YAML or JSON. YAML exception: unacceptable character '' (0x0) special characters are not allowed in "<reader>", position 0, JSON exception: Unexpected character () at position 0.. Update the configuration file.
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

更新:

__MACOSX/ 从存档中删除,现在抛出错误:

The configuration file gf/.ebextensions/project.config in application version gf4 contains invalid YAML or JSON. YAML exception: while scanning for the next token found character '\t' that cannot start any token in "<reader>", line 7, column 1: date.timezone = "Europe/Berlin" ^ , JSON exception: Unexpected character (f) at position 0.. Update the configuration file.
Run Code Online (Sandbox Code Playgroud)

该文件似乎有问题,但我无法发现是什么。

编辑:我需要从文件中删除几个选项卡并替换为空格。这与下面的答案一起修复了它。

Mic*_*ton 9

您正在使用 Macintosh,并让隐藏__MACOSX目录进入您的部署。这些文件是在您压缩目录以保存 OS X 特定资源分支时生成的,这些分支在任何其他操作系统上都没有用。

如果您打算使用zip打包应用程序进行部署,则需要删除这些 Better to use git、Capistrano 或实际适合部署软件的东西。