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

51

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? Commented Sep 1, 2017 at 0:42
  • 1
    @user1448031 Yes it's automatically created! Commented Sep 1, 2017 at 6:48
  • Is it also applicable in Ubuntu. I'm having the same issue. Commented 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? Commented 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! Commented Jun 19, 2018 at 2:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.