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?

1 Answer 1

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.

5
  • So does that mean /etc/php.d/project.ini file is automatically created when the new app version is deployed? Sep 1, 2017 at 0:42
  • 1
    @user1448031 Yes it's automatically created!
    – BenMorel
    Sep 1, 2017 at 6:48
  • Is it also applicable in Ubuntu. I'm having the same issue. May 25, 2018 at 8:28
  • I tried this and it caused my Laravel app to crash. Any thoughts as to what might have gone wrong? Jun 19, 2018 at 1:53
  • 1
    Never mind, it did work, thanks! My issue was unrelated - for some reason eb deploy isn't working but uploading a zip is, which is a whole other ball of wax. Once I manually deployed it it worked like a charm! Jun 19, 2018 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.