Common causes
- upload_max_filesize is left at the PHP default of 2M or a low host default
- post_max_size is smaller than upload_max_filesize, so the whole request is discarded
- Nginx client_max_body_size (default 1m) blocks the request first, returning 413
- Settings changed in the wrong php.ini, or PHP-FPM not restarted after editing
- A multisite network 'Max upload file size' setting lower than PHP's limit
How to fix it
- Check the current limits. Go to Tools > Site Health > Info > Server to see upload_max_filesize and post_max_size, or check phpinfo(). The media uploader shows the smaller effective limit.
- Raise the limits in php.ini. Set upload_max_filesize = 128M and post_max_size = 128M (post_max_size must be equal or larger) in the active php.ini, then restart PHP-FPM with sudo systemctl restart php8.3-fpm. On shared hosting use the control panel's PHP options or MultiPHP INI Editor.
- Use .user.ini or .htaccess on shared hosting. For PHP-FPM/CGI, create .user.ini in the WordPress root with the same two lines; changes apply after user_ini.cache_ttl (5 minutes by default). For Apache with mod_php, use php_value upload_max_filesize 128M in .htaccess instead.
- Raise the Nginx body size. Add client_max_body_size 128M; to the http, server or location block, test with sudo nginx -t, and reload with sudo systemctl reload nginx. Without it, Nginx returns 413 before PHP sees the file.
- Check multisite settings. On multisite, go to Network Admin > Settings and raise 'Max upload file size'. It cannot exceed PHP's limits.
- Upload very large files another way. For files larger than your host allows, upload them over SFTP to wp-content/uploads and register them with wp media import /path/to/file.zip.
php.ini / .user.ini and Nginx
; php.ini or .user.ini
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
# nginx server block
client_max_body_size 128M; How to stop it happening again
- Set upload limits as part of your server provisioning, not after the first failure
- Keep post_max_size equal to or larger than upload_max_filesize
- Keep Nginx client_max_body_size in sync with PHP's upload limits
- Compress or resize images before upload to stay well under the limit