Error when customising EC2 instance php.ini file on AWS

goose asked:

I’m using Elastic Beanstalk on AWS and I’m trying to override some settings from the php.ini file. I’ve made the directory /.ebextensions with project.config within it:

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

When I redeploy the application, EBS throws the following error:

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.

What have I done wrong?

UPDATE:

__MACOSX/ removed from archive now throwing error:

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.

There seems to be something wrong with the file, but I can’t spot what.

EDIT: I needed to remove a couple of tabs from the file and replace with spaces. This fixed it along with the answer below.

My answer:


You’re using a Macintosh, and you let the hidden __MACOSX directories get into your deployment. These files are generated when you zip up a directory to hold the OS X specific resource forks, which are useless on any other operating system.

If you’re going to use zip to package your app for deployment, you need to remove these Better to use git, Capistrano, or something actually suited to deploying software.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.