Hey!
I’m assuming that you’ve reached this article because you’re (probably desperate) looking for a solution to fix your issues with empty $_POST
or $_FILES
variables in PHP, right?
This content was originally posted on my Medium blog.
Well, I was pretty much like you up to 2 days ago and what I can tell you is, the solution might be far simpler than what you’re thinking!
Making a long sentence short: Check on your php.ini file if the
enable_post_data_reading
property isOn
.
The PHP relies on that property to know whether populate or not populate the $_POST
and $_FILES
superglobal variables.
Back to my story …
I first noticed the problem when trying to make some changes to my client’s project, an OpenCart based e-commerce. Basically, the entire store was working fine, but I couldn’t login at all, neither as a client or administrator.
After spending some days googling about OpenCart and a possible authentication issue, with any success at all, I realized that the problem could be on the PHP configuration when I remembered that my Mac OS was updated few months before, which also has made some changes to the Apache and PHP settings!
Tada~! Solution found!
Looking into the PHP ini file, I did figure out that the property enable_post_data_reading
was set to Off
, while it’s advised to be On
. Actually, it’s supposed to be On by default, but for some unknown reason, it was turned off by the time I’ve updated the OS!
Once that property was set back to On
, everything starts working back. 🙂
By the way, if you need to check all other properties from the PHP settings, you can refer to this website:
http://php.net/manual/en/ini.core.php
See you soon! Cheers. 🍻
Top comments (0)