Symptoms
-
Unable to upload a file using a web application or webmail, the following error is shown:
An error occurred!
File upload failed -
When uploading a big file via the WP dashboard > Media > Add New Media File interface (for example, a video file with a size of 2.2 GB), the following error is shown:
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
In connection with this error, entries that are similar to the following are recorded in nginx or Apache error logs for the domain:
Error 203.0.113.2 2043720#0: *789 client intended to send too large body: 2362,232013 bytes nginx error
Warning 203.0.113.2 mod_fcgid: HTTP request length 134224506 (so far) exceeds MaxRequestLen (134217728), referer: https://example.com/wp-admin/upload.php Apache error
-
The following error can be seen in the browser's console:
413 Request Entity Too Large
Cause
The current web server limits are insufficient for the file size and are preventing a larger file from being uploaded via PHP, due to which they need to be increased.
Resolution
Note: For the WordPress script specifically, you can resolve the big file upload issue for the default Media Library upload feature of WP itself by adding the chunked file upload capability, which is done by simply installing the following plugin:
Big File Uploads – Increase Maximum File Upload Size – WordPress plugin
- Log into Plesk
-
Go to Domains > example.com > Dashboard > PHP in order to determine which of the following web server, PHP handler (and PHP version) combinations is being used for the affected domain:
FPM application served by Apache
FPM application served by nginx
FastCGI served by Apache - Depending on the situation for the affected domain, use the steps in the corresponding section:
Click on a section to expand
Solution per domain
Note: The steps below are valid when Nginx proxies requests to Apache
1. Log into Plesk
2. Go to Domains > example.com > Dashboard > PHP
3. Set the post_max_size
and upload_max_filesize
to a value that is sufficient for the file that you are trying to upload (For example 3G).
4. Scroll down and press Apply
5. Go to Domains > example.com > Hosting & DNS > Apache & nginx
6. Set the Maximum allowed HTTP request body size (also known as client_max_body_size
) to the same value that you used for post_max_size
and upload_max_filesize
(for example 3GB)
Solution for all domains using a certain PHP version and Service Plan
2. Adjust the following settings of of the PHP version and PHP handler used by the domains in Tools & Settings > PHP Settings > X.X.XX FPM application > php.ini tab:
post_max_size 3G
upload_max_filesize 3G
3. Go to Service Plans > SERVICE_PLAN_NAME > Web Server > nginx settings
4. Set the Maximum allowed HTTP request body size (also known as client_max_body_size
) to the same value…