Amazon Elastic Beanstalk: add/change php.ini settings

Hi folks,

I’m going to tell you how to add (or change/rewrite) settings for php.ini if you deploy your project on elastic beanstalk. I need to change two values in php.ini upload_max_filesize and post_max_size.

To start with, need add directory with name `.ebextensions` and add file there with some meaningful name with trailing `.config`. I created `phpini.config` file

Secondly need create yaml or json formatted content for the file. I choosed yaml but it doesn’t matter really:

files:
  "/etc/php.d/project.ini" :
    mode: "000644"
    owner: root
    group: root
    content: |
      upload_max_filesize = 256M
      post_max_size = 256M

Note: you may see how it looks in json here: Online YAML Parser

So after that put content to your instance. I use git to deploy something like that:

> git add --all
> git commit -m 'Added amazon config with upload_max_filesize and post_max_size'
> git aws.push

That’s it. See errors on AWS Dashboard if you make some mistake on configuration file amazon will notify you in “Recent Events” list.

Books to read

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *