If you’re a WordPress Web Designer or building a website on WordPress hosting site that hosts large single media files, sometimes running into 100s of MBs, then you might face some problems while uploading media files exceeding the size of 25MB. You can simply increase Maximum Upload File Size in your WordPress Website by adding couple of lines to your website.
You will usually face 500 Internal Server Error at the most unwanted time.
Usually, web hosting providers set the maximum upload size in WordPress Ranges from 2MB to 150MB depending on the host servers.
How to Check Current Maximum Upload File Size?
To check the current max upload size limit in your WordPress site, navigate to WP Admin Dashboard -> Media -> Add New. You’ll see the current max upload size at the bottom as shown in the screenshot.
If the current max upload size limit meets your demand then you can leave it the same. However, if it doesn’t, take a look at multiple ways to increase the max upload file size limit in WordPress and find the one that suits you best.
Method 1: Update .htaccess file
If you’re using Apache Web Server coupled with PHP, then you can increase maximum file upload size by adding a few lines of code in your WordPress .htaccess file.
To access your .htaccess file, you’ll need to connect to your server via FTP Client or use cPanel’s File Manager and navigate to the root folder of WordPress Installation. Open up .htaccess in a code editor like VSCode or NotePad and add the following lines at the end.
php_value upload_max_filesize 64M php_value post_max_size 128M php_value memory_limit 256M php_value max_execution_time 300 php_value max_input_time 300
This will define the max upload size in MegaBytes. Replace numbers as per your requirements for further increments. The max execution time and max input time is in seconds.
Method 2: Edit Functions.php File
If you’re not able to access .htaccess file, and comfortable editing WordPress Theme Files. You can easily increase the max upload size limit by adding a few lines of code in the functions.php file of your theme.
However, it’s not a recommended method to choose because if you change the theme then max upload size will return to its default size, until you edit the functions.php file of the newly activated theme.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
Method 3: Create or Edit Existing php.ini File
php.ini file is the default file used to configure any application which runs on PHP. This file contains every parameters required for file timeout, upload size, and resource limit.
To edit a php.ini file, connect to your server via FTP Client or use cPanel’s File Manager and navigate to the root folder of WordPress Installation. Look for the php.ini file in the root directory. If you don’t find one, create a new file called “php.ini”, add the codes given below in it and upload it in the root directory.
upload_max_filesize = 25M post_max_size = 25M memory_limit = 15M max_execution_time = 300
Note: If you are using a shared hosting service, you won’t find a “php.ini” file, instead you’ll need to edit these settings from your cPanel.
Method 4: Configuring php.ini From cPanel
As mentioned above, if your using shared hosting, this is the simplest way to increase your Max Upload Size.
To do so, you’ll need to access your shared hosting cPanel account, then go to “Select PHP Version” -> “Options”. Here you’ll find every PHP related setting that you can tweak for the enhanced WordPress Experience.
Method 5: Contact your Hosting Provider
If you don’t want to edit the files yourself, you can always contact your hosting provider to do it for you. We at TechNextGen use FastComet for Hosting Website, and they are superb at their job. Also, all of my tickets are generally solved within an hour or two. They offer reliable Managed WordPress Hosting at cheap rates low as $2.69/month.
I hope you’ll like the guide to maximize your Max Upload File Size Limit. See you guys in the next one.