WordPress reports “Maximum upload file size: 8 MB” in the media library footer and a podcaster trying to upload a 90 MB MP3 hits the wall. The limit is not a WordPress setting — it is PHP’s upload_max_filesize and post_max_size, surfaced by WordPress through wp_max_upload_size(). Raising it is mechanical; raising it correctly without leaving the install exposed to abuse takes a bit more care.
What’s happening
WordPress calculates the upload limit as the smaller of upload_max_filesize and post_max_size from PHP’s runtime configuration. The defaults on shared hosting are typically 2-8 MB. There are five places the value can be set, in order of precedence: server-level php.ini, PHP-FPM pool config, .user.ini in the document root, .htaccess directives (Apache only), and ini_set() calls in code (only works for ini values flagged PHP_INI_PERDIR or PHP_INI_ALL).
upload_max_filesize cannot be raised by ini_set() from PHP code — it must be set in php.ini, .user.ini, or .htaccess. This catches every developer who tries to bump it from wp-config.php and wonders why nothing changes.
How to verify
wp eval 'echo wp_max_upload_size() / 1024 / 1024 . " MB" . PHP_EOL;'
wp eval 'echo "upload_max_filesize: " . ini_get("upload_max_filesize") . PHP_EOL;'
wp eval 'echo "post_max_size: " . ini_get("post_max_size") . PHP_EOL;'
wp eval 'echo "max_execution_time: " . ini_get("max_execution_time") . PHP_EOL;'
php --ini | grep "Loaded Configuration"
php -i | grep -E "upload_max_filesize|post_max_size|memory_limit"
find /home/example/public_html -name ".user.ini" -o -name "php.ini" 2>/dev/null
Compare what WordPress reports with what PHP reports on the CLI — they should match. If WordPress reports 8 MB but the CLI shows 64 MB, the web SAPI has a different config than the CLI SAPI (common with cPanel’s MultiPHP setup).
The fix
- Pick the right scope. On a managed host, use
.user.iniin the WordPress document root — it survives core updates and isn’t shared with other sites. On a dedicated server, set the value in the PHP-FPM pool config so it can’t drift. - Match all three limits. Set
upload_max_filesize,post_max_size, andmax_execution_timetogether.post_max_sizemust be at least as large asupload_max_filesize. For a 100 MB upload limit, usepost_max_size = 110Mto allow for form fields and overhead. - Restart PHP-FPM after server-level changes.
.user.inichanges pick up withinuser_ini.cache_ttl(default 300 seconds). Pool config changes need a gracefulsystemctl reload php-fpm. - Cap it at what you actually need. A 1 GB upload limit on a public site invites abuse — every authenticated upload form becomes a vector for filling the disk. Set the limit at 2-3x the largest legitimate file your team uploads, not at “as high as possible.”
- Add a separate route for very large files. Podcasts and video belong on S3-compatible object storage, not in
/wp-content/uploads/. Stack Harbor’s enterprise WordPress operations deployments scope upload routes and limits during architecture review, not after the first content team complaint.
Stack Harbor’s enterprise WordPress operations deployments size PHP limits to the editorial workload during onboarding, not after the first complaint. When upload limits keep biting the team, start the conversation.