This post describes how to configure
post_max_size at application level, instead of setting them in php.ini.
IMHO, php.ini is for setting basic configuration across all applications. It should be "low spec", just enough for most applications. This is to prevent unintentional "abuse" from applications using large among of resources (e.g. execution time, memory limit, upload file size limit). Supposed default
upload_max_filesize in php.ini is 2MB, and a particular applications requries upper limit of 20MB. I prefer to set it at application-level, instead of php.ini. I dont want other applications to easily upload big files.
There are few ways to overwrite default PHP configurations. For most configurations,
ini_set() can be used to overwrite configuration at runtime.
Referring to List of php.ini directives,
ini_set() does not work for all configurations.
post_max_size are classified as PHP_INI_PERDIR. Meaning they can only be set in php.ini, .htaccess, httpd.conf or .user.ini. Since I am using Apache web server, I set them in .htaccess.