Whether you’re trying to upload a large image, video, or another file, you may have encountered the WordPress upload size limit. This error message can be frustrating, especially if you’re trying to upload a file that’s perfectly within the WordPress size limits. Checkout the Top 5 working methods in 2023 to increase the max upload size in WordPress on Apache & Niginx server.
Info
The default max upload file size at WordPress site is set to 128 MB.
In this article, we’ll show you how to increase the maximum upload size in WordPress so you can upload large files without any errors. We’ll also discuss some common reasons why you may need to increase your upload size limit in the first place.
Select your Server
Increase the Max Upload Size on Apache Server
In this case, we got 3 ways to solve this issue, you can follow any of these:
1. Modify Your ‘.htaccess’ File
Location – You can find your .htaccess file in the WordPress site’s root directory.
As per PHP documentation, three PHP directives are responsible for how WordPress handles uploads are as follows:
upload_max_filesize
post_max_size
memory_limit
For example, if you want to increase the upload size to 32MB we would recommend following the below settings:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M Please note: "M" stands for MB
Access your .htaccess file via FTP/SFTP or your hosting provider’s File Manager.
Open or create the .htaccess file, and then add the following code:
php_value upload_max_filesize 32M php_value post_max_size 64M php_value memory_limit 128M php_value max_execution_time 300 php_value max_input_time 300
The max_execution_time directive defines how long a server spends on a single PHP task. For example, if you upload a large file, the server will spend more time processing the file. The max_input_time directive defines the maximum time a script can spend parsing input data. This time is measured in seconds.
For example, if you are expecting large file uploads, you may need to increase the max_execution_time and max_input_time values. Conversely, if you are not expecting large file uploads, you may want to decrease these values to improve server performance.
⚠️ If you are facing a ‘500 Internal Server Error’
Most likely, your server is running PHP in CGI mode. In such cases, you cannot use the above commands in your .htaccess file.
2. Modify Your ‘php.ini’ File
The php.ini file is where you make changes to your server’s PHP settings. This is where you would define file timeouts, max upload sizes, and resource limits.
To find the php.ini file on your WordPress site, use SSH or FTP to access your site’s root directory. In some cases, the file may not be located there. If this is the case, you can create a new php.ini file in your site’s root directory.
All you need is to add the following code to your php.ini file:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M
Increase the Max Upload Size on Nginix Server
Nginx is another popular web server, similar to Apache. Nginx is known for being able to handle a high number of concurrent requests, which makes it a very fast webserver. We recommend having Nginx server as its performance-optimized hosting solution for WordPress websites. Having Nginx powering your WordPress website can result in noticeably faster loading times for your visitors.
If your WordPress site is on Nginx, you’ll need to modify both your php.ini and nginx.conf files.
On an Nginx server, you can find the php.ini file at /etc/php/7.4/fpm/php.ini
upload_max_filesize = 64M post_max_size = 128M
After saving your php.ini file, enable the changes by restarting PHP-FPM using the below code in your terminal:
sudo service php7.4-fpm restart
Now find the nginx.conf file at /etc/nginx/nginx.conf
You can declare this directive inside the http {...}
block, the server {...}
block, or the location {...}
block.
Setting it in the http block will affect all the sites/apps hosted on this server.
http {
...
client_max_body_size 128M;
}
Defining it in the server block will only affect a specific site/app hosted by this server.
server {
...
client_max_body_size 128M;
}
The location block only affects the specified directory (e.g. files, uploads) inside a site/app.
location /files {
...
client_max_body_size 128M;
}
Don’t forget to save the file and restart Nginx to apply the changes. To do that, you can use the following command in your terminal:
sudo service nginx reload
Other methods
Increase size with the plugin
If you’re not comfortable working with code, you can use a WordPress plugin to make changes to your website. WordPress plugins are easy to install and use, and they can help you add new features or make changes to your website without having to edit code.
The plugin is very simple to use. Just install and activate it, and then go to Settings > Maximum Upload File Size. All you need to select the desired maximum file size from the dropdown as shown in the above image. Once, you select the size now save it. Simple.
Upload Files via FTP/SFTP
Still, struggling with all the methods? The only option left is to upload files via FTP or SFTP. You might need to contact your hosting provider to get the FTP details for your account.
This method is a traditional method since ever the FTP was introduced to the computer world. Even if you want to upload large files FTP is one of the fastest methods. With FTP you can upload the files in bulk. If you are unable to upload the desired large files then ask your hosting provider support to increase the upload max size.
Recommended FTP Softwares are:
- FileZilla (Free) – Download
FileZilla is a free and open-source, cross-platform FTP application, consisting of FileZilla Client and FileZilla Server. Clients are available for Windows, Linux, and macOS. - CyberDuck (Free) – Download
Cyberduck is a libre server and cloud storage browser for Mac and Windows with support for FTP, SFTP, WebDAV, Amazon S3, OpenStack Swift, Backblaze B2, Microsoft Azure & OneDrive, Google Drive, and Dropbox. - Forklift (Paid) – Download
A forklift is exclusively designed for macOS. You can try Forklikft with the free plan and the license starts from $19.95 including a Lifetime license & 1 year of free updates.
✋Editing the wp-config.php file doesn’t work anymore
Many web tutorials suggested adding the following code to the wp-config.php file
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '128M');
@ini_set( 'memory_limit', '256M' );
This will fail as upload_max_size and post_max_size belong to the PHP_INI_PERDIR changeable mode. You can only set them via php.ini, .htaccess, http.conf, or .user.ini which we have shown how to add the codes to these files in the above methods based on your apache or Nginx server.
Verify Your WordPress Site’s New Max Upload File Size
Now it’s time to check if the changes you made are working or not. You need to go to your Media Library in the WordPress dashboard and check whether the max upload file size limit has changed.
🎉 That’s it, Amigo. You have successfully set the new max upload file size. Still, having some issues or got stuck at any step? we are glad to help you just tell us in the comments.