I have been exploring Elastic Beanstalk for easy deployment of my PHP 5.4 application. For my application, I need to make changes in php.ini file.

After some searching on internet i tried to use configuration files in git directory. Following is the content of my file(.config) in .elasticbeanstalk directory in git directory:

    mode: "000644"
    owner: root
    group: root
    source: https://bucketname.s3.amazonaws.com/php.ini

I have uploaded my custom php.ini in my own bucket on s3 and have given all rights to everyone. But still after deployment multiple time I am unable to see new files deployed.

I am using the following code to check for the changes in php.ini file.

  <title>PHP Test</title>
 <?php echo '<p>Hello World2<br/></p>'; 
 echo 'display_errors = ' . ini_get('display_errors') . "\n";
 echo 'register_globals = ' . ini_get('register_globals') . "\n";
echo 'post_max_size = ' . ini_get('post_max_size') . "\n";
echo 'include_path = ' . ini_get('include_path') . "\n";

In my custom php.ini post_max_size has value 8M which shows 32M on beanstalk application.

Edit: I have downloaded my php.ini file from EC2 instance that is running my application. And it is different than my custom php.ini. Further, I am using <?php phpinfo(); ?> to check changes from my php page.


You don't want to be doing this. It could break the upgrade path of Amazon's AMI since it's a rolling release.

Instead of wholesale replacing the entire file, specify the changes that you need in a custom .ini file and put it in /etc/php.d/. If a setting in the custom .ini conflicts with one specified in php.ini, the custom setting will take precedence.

  • I am running into a similar problem. In your addition of a custom .ini file to /etc/php.d/ do you mean that it is necessary to connect to each running instance behind the beanstalk loadbalancer and apply this file? – Hal Jan 25 '13 at 21:09
  • @Hal, no you have to use an Elastic Beanstalk config file to do it. SSHing into each instance and doing it would just mean your changes were reset each time a new instance started. – jamieb Jan 25 '13 at 21:38
  • @jamieb - So, exactly WHERE does one make the change to php.ini, or more precisely, the php.d file. I'm really not following what your recommending; "no, don't use the Elastic Beanstalk config file" and "No, you ssh into each instance...". So where? I'm having exactly the problem you mention in point 2... the changes I make are being wiped out each time the instance is started. How and where should those changes be made to make them "stick"? – user183915 Aug 1 '13 at 1:04
  • @wagnert Use an Elastic Beanstalk config file to copy your custom PHP ini file from an S3 bucket to /etc/php.d. – jamieb Aug 7 '13 at 23:12

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.