In this quick tutorial, you’ll learn how to increase the WordPress max upload size without the use of a plugin. Rather, we can modify the php.ini file which dictates how much a user is allowed to upload to a web server.
Why Change the Upload Size in WordPress?
When trying to upload a large file to a web server, you might come across the following PHP error message.
The uploaded file exceeds the upload_max_filesize directive in php.ini
This error message is directly related to issues that many users run into with the popular All-in-One WP Migration plugin. This plugin allows users to move their website from one web host to another by exporting their website as a file. However a lot of the time, the exported file is very large.
Since most browser uploads use PHP on the server side, these uploads are restricted to PHP limits.
Unfortunately, the free version of the plugin must respect this upload limit which can be very small for some hosting providers. In the example below, the maximum upload size is only 16 MB.
While the plugin suggests to change some values in your .htaccess and wp-config.php file, these fixes rarely work. This leads the user to purchase the premium version of the plugin for $69.
Don’t fret though! You can change the max upload size without buying a premium plugin.
How to Increase PHP Upload Size
Login to your web host via ssh or FTP and edit the php.ini file. In most cases, this file is located at
/etc/php/7.2/apache2/php.ini. You might have to adjust the path for your version of PHP if you’re not running 7.2.
Find the following configuration variables and change them as appropriate.
upload_max_filesize = 1024M post_max_size = 1024M
In the example above, 1024M represents 1,204 megabytes or 1 gigabyte. Of course, you can specify any value here and use K for kilobytes, M for megabytes, and G for gigabytes.
To be safe, make sure that upload_max_filesize and post_max_size have the same value.
After you are satisfied with your changes, restart apache with
service apache2 restartor equivalent command.
Finally, try the upload again. If you followed this tutorial, you should now be able to upload much larger files.
Let me know if you have any questions about changing the WordPress max upload size in the comments below.