Understanding the Error
WordPress shows limit (e.g., "Maximum upload file size: 2MB").
Fix 1: Increase PHP Settings
Edit php.ini:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
memory_limit = 256M
Restart PHP-FPM:
sudo systemctl restart php*-fpm
Fix 2: .htaccess Method
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value memory_limit 256M
Fix 3: Nginx Configuration
# In server block
client_max_body_size 64M;
# Reload Nginx
sudo systemctl reload nginx
Fix 4: wp-config.php
@ini_set( 'upload_max_filesize' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'memory_limit', '256M' );
Fix 5: Functions.php
add_filter( 'upload_size_limit', 'PBP_increase_upload' );
function PBP_increase_upload($bytes) {
return 67108864; // 64MB in bytes
}
Verify Changes
Create info.php:
<?php phpinfo(); ?>
Search for "upload_max_filesize" to confirm value.
⚠️ Very large uploads may need chunked upload plugins.