My /etc/php.ini has the following configuration:

upload_max_filesize = 2M
post_max_size = 32M

And /etc/php.d/app.ini contains:

upload_max_filesize = 64M
post_max_size = 64M

With PHP 5.4, PHP was giving precedence to the app.ini values over the ones from php.ini; however, since I switched to PHP 5.5, they're not taking precedence anymore:

# php -r "echo ini_get('upload_max_filesize');"

The app.ini file looks successfully parsed by PHP:

# php --ini

(/etc/php.d is a symlink to /etc/php-5.5.d)

How can I force php.d ini files to take precedence over php.ini?

If that makes any difference, I'm using the AWS Elastic Beanstalk container for PHP 5.5.


Found the reason, which is indeed specific to the Elastic Beanstalk container for PHP 5.5.

For some obscure reason, the AWS team chose to move php.ini from its original location in /etc/php.ini to /etc/php.d/php.ini.

Because the files in php.d are processed in alphabetical order, my app.ini was now processed before php.ini, and was thus overridden.

I have opened a thread on the AWS forums, to ask AWS if they would consider moving php.ini back to its original location.

In the meantime, the solution is simply to rename the file to make it appear after php.ini, in my case renaming to zapp.ini did the trick.

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.