26

I'd like to add these PHP settings to my Elastic Beanstalk environment:

upload_max_filesize = 64M
post_max_size = 64M

These options cannot be set with option_settings in .ebextensions:

Namespace                                    | Extend
---------------------------------------------|-------
aws:elasticbeanstalk:application:environment | Yes
aws:elasticbeanstalk:container:php:phpini    | No

How can I add custom settings to php.ini in an Elastic Beanstalk container?

BenMorel
  • 4,215
  • 10
  • 53
  • 81

1 Answers1

50

The cleanest way I found is to use a .ebextensions config file in my project archive:

Sample .ebextensions/project.config file:

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

When the application version is deployed, this will write a custom config file in the php.d directory, that will override any php.ini setting.

BenMorel
  • 4,215
  • 10
  • 53
  • 81