PHP $_POST Empty After Setting post_max_size & upload_max_filesize

,

$_POST was empty! Firebug showed that the web browser was submitting the form’s data to the server. Yet, for some reason, PHP was not putting the data into the $_POST array. If I switched the form’s action from POST to GET, PHP properly populated $_GET. What was wrong with $_POST?!

Shortly prior to this problem appearing, I had set a couple of configuration directives in a php.ini file fragment—something like this:

post_max_size	        2GB
upload_max_filesize     2GB

Looks correct, doesn’t it? Nope!

I learned the hard way that PHP uses single letter abbreviations to indicate kilobytes (K), megabytes (M) and gigabytes (G)! Dropping the “B” off of each “GB” fixed the problem—PHP went back to properly populating $_POST.

Interestingly, phpinfo() and ini_get() won’t necessarily cough about the extraneous “B” being present. This deceptive acceptance of incorrectly formatted configuration values can complicate debugging.

Thanks to Stack Overflow for providing the answer I needed to solve this perplexing $_POST issue!

 

Leave a Reply

Your email address will not be published. Required fields are marked *