PHP INI directives configuration methods

This morning i had come across an issue while setting value for upload_max_filesize and post_max_size.
Tried .htaccess method as below,

php_value upload_max_filesize              256M
php_value post_max_size                    280M

Also used below method too from php script

ini_set('memory_limit', '880M'); // worked
ini_set('post_max_size', '280M'); // didn't work
ini_set('upload_max_filesize', '256M'); // didn't work

Unfortunately both method didn’t work. I could set values in php.ini and made it work. But, I dont wanted to touch php.ini.
What worked is setting the directives and values in .user.ini file as below.

post_max_size = 280M
upload_max_filesize = 256M

Below 2 links explains the reason:
http://php.net/manual/en/configuration.changes.modes.php
http://www.php.net/manual/en/ini.list.php

Leave a Reply