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?


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

Sample .ebextensions/project.config file:

  "/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.

  • So does that mean /etc/php.d/project.ini file is automatically created when the new app version is deployed? – user1448031 Sep 1 '17 at 0:42
  • 1
    @user1448031 Yes it's automatically created! – BenMorel Sep 1 '17 at 6:48
  • Is it also applicable in Ubuntu. I'm having the same issue. – alyssaeliyah May 25 '18 at 8:28
  • I tried this and it caused my Laravel app to crash. Any thoughts as to what might have gone wrong? – James Morrison Jun 19 '18 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! – James Morrison Jun 19 '18 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.