After looking at this question about upload_max_filesize
, I started to wonder: since ini_get
simply returns the raw string-value (e.g. '15M'), what component actually reads this value and then uses it to limit uploads? Would it be Apache or the CGI-engine? Or is this handled by essential PHP-runtimes instead?
For the former, I would assume that most softwares which can serve PHP-pages have a way of converting this shorthand ini-value to bytes (or some machine-usable integer) and then notifying PHP when this limit has been exceeded during a POST action. Is this indeed the case? (Maybe PHP converts the string first?)
TL;DR: What component is responsible for picking up the upload_max_size
value and passing it to the enforcement mechanism(s)? Or alternatively: Does this setting indeed exist strictly to allow a DIY-implementation of this limit?
Why I ask: The answers given in the linked question are somewhat unsatisfactory because they all basically suggest various blocks of "here paste this code" to convert the string. What's missing is any information about the location of internal mechanisms that already do this for PHP, so that it/they can be used directly, or at least faithfully emulated.