Troubleshooting Upload_max_filesize Modification in PHP
Changing the upload_max_filesize in PHP can be a straightforward task; however, some unexpected behaviors can arise under certain circumstances.
In a recent query, a developer encountered a puzzling issue while attempting to modify the upload_max_filesize using ini_set(). Despite setting the value to 10M both in their code and in php.ini, the resulting output indicated that the file size limit was still 2M.
Insightful Observations and Resolving the Issue
One possible explanation for this discrepancy is the incorrect use of shorthand notation when setting configuration values outside of php.ini. The shorthand notation ('10M') is often used to represent bytes, which could be interpreted incorrectly by the system.
Moreover, the "official" list suggests that upload_max_filesize cannot be set using ini_set() because it's designated as PHP_INI_PERDIR. This means that modifications to this configuration value should be made within the php.ini file itself.
Finally, it's worth noting that in this specific case, restarting Apache resolved the issue. This reiterates that changes made to the php.ini file may not take effect immediately and require an application restart for the modifications to be applied.
The above is the detailed content of Why Doesn't My PHP upload_max_filesize Change Despite Using ini_set()?. For more information, please follow other related articles on the PHP Chinese website!