How to change php.ini settings on AWS Elastic Beanstalk

How to edit PHP.ini settings like upload_max_size and upload_post_size in elastic beanstalk

The Problem

I was working on deploying an existing app from a simple EC2 instance to a managed Elastic Beanstalk Application, one of the things I needed to change was the upload_max_size and post_max_size .. unfortunately, the documentation for Beanstalk is notoriously lacking, but I was eventually able to figure out how to do this.. so here’s how you would do it

EB Extensions folder for the rescue

As with most beanstalk things, you’ll need to make a change/additon to your .ebextensions folder, basically add a .config file in there.

files:
  "/etc/php.d/mycustomsettings.ini" :
    mode: "000644"
    owner: root
    group: root
    content: |
      upload_max_filesize = 30M
      post_max_size = 30M
      max_input_time = 600
      html_errors = "On"
      display_startup_errors = "On"

And so on. You can always look at what php.ini files are on your system with phpinfo(); and then overwrite an existing one too.. but I prefer overriding the settings.

Hope this helps you save some hair off your head.