Key takeaways
- 413 means the upload is bigger than a limit somewhere between the browser and PHP.
- There are usually two limits to raise: the web server's and PHP's.
- Raise limits to what you need, not to unlimited.
413 Request Entity Too Large (called Content Too Large in newer specs) means the request body — usually a file upload — is larger than the server is configured to accept.
Where the limits live
| Layer | Setting | Typical default |
|---|---|---|
| Nginx | client_max_body_size | 1 MB |
| Apache | LimitRequestBody | unlimited or 1 GB |
| PHP | upload_max_filesize | 2 MB |
| PHP | post_max_size | 8 MB |
The upload must fit under every limit in the chain.
On a VPS with Nginx
- Edit the site’s server block, for example
/etc/nginx/sites-available/example.com:
server {
client_max_body_size 64M;
# ...
}
- Test and reload:
sudo nginx -t && sudo systemctl reload nginx. - Raise PHP’s limits in
php.ini(path shown byphp --ini), then restart PHP-FPM:
upload_max_filesize = 64M
post_max_size = 72M
On Apache
Check for a LimitRequestBody directive in the virtual host or .htaccess and raise it (the value is in bytes), then reload Apache.
On cPanel hosting
- Open Software → MultiPHP INI Editor and choose your domain.
- Set
upload_max_filesizeandpost_max_size(keeppost_max_sizeslightly larger). - Save, then retry the upload.
Frequently asked questions
I raised upload_max_filesize but still get 413. Why?
413 is returned by the web server before PHP runs. On Nginx, raise client_max_body_size; on Apache, check LimitRequestBody. Then make sure post_max_size is also larger than the file.
Can I fix this on shared hosting?
Usually yes for PHP limits, through cPanel's MultiPHP INI Editor. The web server limit on shared hosting is normally set generously; if it isn't, ask support.