Error related to max post size, upload max file size, max execution time, max input time or memory limit
If you encounter errors during requests such as:
- PostTooLargeException in ValidatePostSize.php line XX
- HTTP 500 Payload Too Large
- Unable to decode input (e.g. during Image upload)
- Errors related to size, time or memory limit
Check these parameters in your php.ini file:
- max_file_size
- upload_max_filesize
- post_max_size
The issue typically occurs because the default max_file_size value is smaller than your file size.
Solution
Multiple variables from your php.ini file require adjustment:
- post_max_size
- upload_max_filesize
- max_execution_time
- max_input_time
- memory_limit
Example configuration for 17MB file uploads:
post_max_size = 128M upload_max_filesize = 64M max_execution_time = 120 max_input_time = 240 memory_limit = 512M
Advanced Solutions
Nginx Settings: Configure client_max_body_size in nginx.conf. The default value is 1m, limiting POST requests to 1MB. Increase to 20m or higher as needed.
Apache Settings: Check LimitRequestBody in your Apache configuration. Unlike Nginx, Apache has no default restrictions, so modification may not be necessary.