WordPressโ new built-in media players make it a powerful platform for streaming video and audio. But you might notice that your WordPress install has a prohibitive maximum file size for uploads. If you want to know what your siteโs upload limit is, you can visit Media -> Add New. Below the upload box you will see โMaximum upload file sizeโ with a number next to it, in megabytes. This is how big your uploaded files can be. By default, this number ranges anywhere from 2MB to 128MB and dictates how big an uploaded file can be. If you find yourself on the smaller end of that scale, you may want to increase your upload limit to accommodate larger media files.
Unfortunately, there is not a one size fits all solution for increasing this limit. How you actually go about increasing the upload limit of your install depends on how your server is configured. In the end, you may have to try a few things before you find something that works. This article will step your through this configuration so that you can find the solution that works for you.
Most of the steps that follow require you to access your site via FTP. If you are unfamiliar with how FTP works, Iโd recommend Kevin Muldoonโs guide to installing WordPress. It has a section on accessing your site via FTP.
Subscribe To Our Youtube Channel
Setting up a PHP Info File
Before you even start trying out different solutions, it can be useful to try and get some details about how PHP is configured on your site. Luckily, PHP has a simple function to help you do this. Create a new file in a text editor of your choice, and add this line of code to it:
<?php phpinfo(); ?>
Name the file โinfo.phpโ and save it. Then, FTP into the root directory of your server, where WordPress is installed, and drag in info.php. Next, visit โhttp://yoursite.com/info.phpโ, replacing โyoursite.comโ with the actual URL of your live site. This will give you a full list of details about your PHP configuration.
Thereโs a lot here, but you can ignore most of it. The most important part of this file is which PHP version you are running. This will be shown in block letters at the top, for instance โPHP Version 5.4.16โ. Itโs most important to pay attention to the first number of your version. You will either be running a version of PHP 4 or PHP 5. Some of the tips outlined here will require you to know which version you are running, so take note of it.
There are three settings within the PHP info file that are relevant to your upload limit. You can search through the file to see what they are currently set to.
- memory_limit โ This defines how much memory is allocated to PHP. You will simply need to ensure that this number is as high or higher than the upload limit you want to set.
- post_max_size โ This defines the maximum size that is handled in a POST request. We will need to set this to our new upload limit.
- upload_max_filesize โ This defines the maximum size for file uploads. This will also be set to our new upload limit.
Now that we have a little bit of info about our PHP set-up, we can try a few different methods for increasing our file size limit.
Editing PHP.ini
If you Google around for ways to increase your upload limit in WordPress, you will probably stumble across a variety of answers. Most of these are workarounds, but the best way to increase the file upload size is to make changes to your serverโs php.ini file. The php.ini file contains all of your PHPโs configuration details, and will let you change the values you saw on your PHP info page.
Note: Before you start making changes to your serverโs configuration, you should make a backup of your site and database. If you find your php.ini file, you will also want to back this file up locally.
Depending on your web host, you may be able to edit this php.ini file directly. To find this file, FTP into your site, and go to the folder that your WordPress install is in. This usually exists in an โhtmlโ or โwwwโ folder. What you will need to do is navigate via FTP to the absolute root directory. This will typically be one or two directories higher than where the WordPress files live.
From the root directory of your server, you are looking for the folder that your php.ini file is located. This is typically in a โconfโ or โetcโ folder. Search through these folders to find a file labeled โphp.iniโ. If you are unable to locate it, trying searching through your web hostโs knowledge base to find its location.
Drag this file to somewhere on your local hard drive, and open it up in any text editor. We will be modifying a few values, so you will need to search through the file to find them. For purposes of demonstration, I am going to increase my upload limit to 64 MB. You can go higher than this, but itโs not recommended that you go higher than 128 MB.
First, find the โmemory_limitโ value, and change this to 64M (unless this is already set to something higher). Next, find the the โpost_max_sizeโ and change this to 64M. Finally, find the โupload_max_filesizeโ and once again change this to 64M. It is important that we use an โMโ to define our filesize limit in megabytes, instead of the commonly used MB. You may also want to find the โmax_execution_timeโ variable and set it to something like 300. This will ensure that your site does not time out when uploading larger files. In the end, your values will look like this:
memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
Though these values will be scattered throughout the file. When you are done, save your file, and drag it back to the directory where your php.ini file is located and overwrite the existing file. It may take a little while for these changes to take effect. If you are on a dedicated server and are able to, you should try restarting your server. If youโre unclear about how to restart your server, check with your web host. Otherwise, make sure your browser and siteโs cache is cleared. Hopefully, when you visit Media -> Add New you will see a new maximum upload size, and youโll be all set.
Uploading your own PHP.ini
If you are unable to find your php.ini file, or if your web host does not give you access to it, you may be able to upload your own file to override the default settings. To do so, create a new file and open it up in your text editor. Then, paste in the following code:
memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M file_uploads = On max_execution_time = 300
Once again, I am setting my upload limit to 64MB, but you can change this value to whatever you want.
Remember your PHP version above? If you are on PHP version 4, then save this file as โphp.iniโ. If you are on PHP version 5, then save this as โphp5.iniโ. If you do happen to be running version 5, and the above filename does not work for you, then you can rename it โphp.iniโ and upload it again.
Then, FTP into your site again, and find the root directory where your WordPress files live. Drag this file into this directory.
Once again, if you have the ability to restart your server you should, then clear your browser and siteโs cache. To confirm whether or not this method worked, go to Media -> Add New and check to see if your maximum file size has increased.
Using .user.ini
If that method still isnโt working for you, you may have another option. This will only work if you are using a version of PHP 5. Otherwise, you can skip this section.
Create a new file, and this time call it โ.user.iniโ. In that file, paste the following code:
upload_max_filesize = 64M post_max_size = 64M memory_limit = 64M max_execution_time = 300
You can change the value of 64M to match your new desired upload limit. Save this file, and then drag it into the directory of your WordPress install using FTP. If you have the ability to restart your server, you should do so. The changes may take a bit to take effect, but go to Media -> Add New to confirm.
Trying .htaccess
If youโve tried the php.ini solutions, and none of them worked, there may be a solution that lies in your htaccess file. In general, htaccess is used to configure an Apache server. However, it can also be used to change PHP values, if your PHP version is set up as an Apache module.
Before you edit your htaccess file, make sure you have a backup. Changing this has the ability to cause an Internal Server Error or a blank white screen, which can easily be removed by simply re-uploading your original htaccess file.
To access your file, go to the root directory of your WordPress install. Make sure that youโve enabled your FTP client to view hidden files, then open up the file labeled โ.htaccessโ to edit. At the bottom of the file, paste in this code:
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
Then save this back to your server. Visit your site, and look for any errors. Then, you can go to Media -> Add New to see if your maximum upload size has taken effect. If you run into any problems, upload the backup htaccess file you saved locally.
WordPress Config File
If all else fails, there is one more trick you can try. This will require editing your WordPress files directly.
The first step is to FTP into your server, and drag your โwp-config.phpโ file, located in the root directory, so that you can edit locally. Open up the file, and at towards the bottom add the line:
define('WP_MEMORY_LIMIT', '64M');
Then upload this file back to the server.
The navigate to your active theme folder in โwp-contentโ and drag your โfunctions.phpโ file to your hard drive so you can edit it. Open it up, and at the very top, insert:
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
This may be able to edit your serverโs php.ini file at runtime. Historically, this is the most effective solution. But on some older set-ups or shared servers, this can sometimes be effective. once again, clear your browser and site cache, and visit Media -> Add New to see if your new limit has taken effect.
Contacting your Web Host
If none of the above solutions work for you, the next step is to contact your web host. Tell them you want to increase the โmemory_limitโ, โupload_max_sizeโ and โpost_max_sizeโ in your php.ini file. Most hosts will not have a problem doing this. If your hosting service will not let you, or are unresponsive, it may be time to find hosting elsewhere.
Increasing Upload Limit on MAMP
Sometimes, you are developing your site locally and you want to increase your limit there. If you are on a Mac, you may be using MAMP, a local server that gives you access to Apache, MySQL and PHP. In other words, everything you need to run WordPress.
Fortunately, you will have access to your php.ini file in MAMP, you just need to know where to find it. The first step is to go to to the โPHP infoโ section located on the MAMP homescreen, up at the top. From there, mark down your PHP version.
Once you know that, go to โ/Applications/MAMP/bin/php/PHP_VERSION/confโ. In the โphpโ folder you will see a list of different PHP versions, so make sure you navigate to the version your system is currently running. From there, you can open up the โphp.iniโ file, and follow the instructions above. Ultimately, you are going to look through the file to change these four variables:
memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
And youโll be all set with a new upload limit in your local environment.
Increasing Upload Limit on WAMP
The Windows equivalent of MAMP is called WAMP. And like MAMP, you will have access to your php.ini file. To find it, go to โC:\WampDeveloper\Config\Php\php.iniโ and open up the php.ini file. Make the changes outlined above, keeping your eye on the four variables that relate to the upload limit in WordPress.
memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
After you change these parameters, the upload limit will be increased.
Finding Your Solution
Unfortunately, there are quite a few things that you may need to try before you can increase the upload limit on your WordPress install. I canโt guarantee that they will work, but hopefully one of these will. If they donโt, donโt hesitate to reach out to your web host for help. A good host will assist you quickly, and get you up and running in no time. PHP configuration is no simple task, but with the meda-rich abilities of WordPress, it may be necessary for you to do so.
Article thumbnail image by Anikei / shutterstock.com
Also worth noting that if you use cPanel hosting, these options are easy to access using the MultiPHP INI Editor app.
Thank you!
This is awesome! .user.ini worked for me, I didn’t know about that ๐
Thank you for this very useful article
So why is it that the troubleshooting methods are different for different setups? Does it have to do with version of php? Does it have to do with the fact that your site is hosted or local? Version of WP?
I need to change this but don’t feel comfortable trying all these methods until I find the one that works.
Thanks for the information though, very good write up.
Having trouble figure this thing! But I am so thankful I visit your blog. Thank you so much!
I’m on a shared hosting account with a Plesk control panel. I found that adding a php.ini did not work but adding a .user.ini file in the root of the WordPress site did work just fine. Thank you!
Despite trying all methods (beside contacting the webhost), I found a small workaround that may help in some instances.
In my case I needed to upload some large pdfs, and needed them to be listed in the media list due to a pdf viewer plugin.
I get a small file file1.pdf and uploaded it with wordpress.
Then I used my ftp client and uploaded the large file2.pdf to the same folder. then with my ftp client I swapped the file names around – now the large file is in the database as file1.pdf and everything works.
Handy also for bulk uploads as ftp may be a little easier to manage these.
Thank you very much for the useful post. I use .user.ini to increase my website upload_max_size and it works perfectly. I didn’t get success with php.ini so I use .user.ini instead.
Go to lib\external\file_uploader.php
Line 65 var $sizeLimit = 10485760;
Line 68 function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
just change the limit. to avoid errors
visit us for more help – http://www.owlsyard.com
I’m using dedicated server, i had try all the method. the last method I had did:
I’m using a version of PHP 5.
Create a new file, and this time call it โ.user.iniโ. In that file, paste the following code:
upload_max_filesize = 512M
post_max_size = 512M
memory_limit = 512M
max_execution_time = 300
WHM–> Tweak Setting –> change to maximum upload size
cPanel PHP max POST size (Minimum: 55; Maximum: 2,047)
55 MB default
MB
cPanel PHP max upload size (Minimum: 50; Maximum: 2,047)
50 MB default
MB
–> Restart FTP server at WHM
All the work-around solutions on the net did not help with my Powweb server, however thanks to this article I was able to locate the information on Powweb to change my php.ini script through their OPs control panel. Powweb installations please look at this help article and do exactly what it says. http://www.powweb.com/knowledgebase/beta/article.bml?ArticleID=2128 works perfectly.
Hey guys – I may be missing something crucial here, but the limit has uploaded fine on my server (onlydomains) however its still showing as 2MB in WordPress itself. What am I missing?
If you are running a multisite installation, you may also have to change the network setting “the max upload file size” in the admin.
Thanks for your thorough post, modifying the php.ini files worked amazingly!
Hi Sir,
Does it necessary to change and increase the value of “memory_limit” and “max_execution_time” ?
Hi guys
I found that none of the above worked for me so I did this…
โข using ftp I navigated to wp-admin
โข then I searched for a php.ini file and found there wasn’t one so I copied the one from the root drive which only had to lines of code and read…
upload_max_filesize = 128M ;
post_max_size = 128M ;
and put that in the wp-admin directory and everything worked… ๐
That worked for me. Thank you so much.
Hi,
I have a really big problem, since i tried this:
define(‘WP_MEMORY_LIMIT’, ’64M’);
@ini_set( ‘upload_max_size’ , ’64M’ );
@ini_set( ‘post_max_size’, ’64M’);
@ini_set( ‘max_execution_time’, ‘300’ );
everything is f*cked up, all pictures dead :/ deleted the entries in the files again but still have this problem… Is there any way to fix this or get it to default again?
best regards,
Daniel
1:- open “C:\wamp\bin\apache\apache2.4.9\bin” folder and find “php” which is a configuration file and open it in ur notepad and again find “upload_max_filesize” and “post_max_size” and change both and save.
2:- open “C:\wamp\bin\php\php5.5.12” folder and find “php” and “phpforapache” which are configuration file and open both in ur notepad and again find “upload_max_filesize” and “post_max_size” and change both and save.
3:- finally restart all services of wamp and enjoy…lov u all
Thank you so much! This was the best article I could find! With help of your instructions I finally managed to change the upload limit! I cannot thank you enough!
Well .htaccess worked for me. However, I got an internal server error using just the php_value lines above, after some searching I found I needed to add the following underneath the line # END WordPress…
# BEGIN UploadIncrease
php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 300
php_value max_input_time 300
# END UploadIncrease
Thanks Jay for sharing this valuable information with us. My website is all about photography and I often encounter upload issues during multiple upload of images. Tried a few plugins but then they interfered with the php.ini files on the server and made my website inaccessible until the issue was fixed by the hosting server support team.
I now know that I can do the same by modifying .htaccess file and also wp-config.php file. This will help me a ton. Thanks again. ๐
I had to do a similar fix just to upload the big zip files for the ET themes I use. Here’s what the Hosting company (BigScoots.com which has good prices and unbelievably great response time on support requests) had me do in the C-Panel:
Click on “Select PHP version”
Select a version other than native, default is 5.3.
Click “Set as current”
Click “Show PHP Settings”
Click the gray setting next to the following options:
“post_max_size”
and
“upload_max_filesize”
You need to change both of these to increase the file size limit.
Thank you absolutely great! I’ve tried everything else and for my situation this only worked!
Thanks again
This was the only option that worked for me!
thank you so much!!!
Is there anyone who reads this who can explain why I canยดt upload .ePub. and .mobi files to WordPress. Their size limit is well within the maximum 2mb upload limit. I have of course used Google to search an explanation, and found ways of bypassing this constriction (changes in function.php and htacces file) but they are old blog posts. And I wonder if I follow these recommendations will my readers who download the ePub or Mobi eBooks get a Anti-Virus warning? Seems these files are simply disallowed in WordPress?
For those with using 1&1 Linux shared hosting, this method below works…
https://wordpress.org/support/topic/changing-phpini-for-wordpress-on-1and1-hosting?replies=5#post-6185256
“but itโs not recommended that you go higher then 128 MB.”
Should be “than” not “then”.
Thanks for the article. On some sites I’ve had to have the hosting company make the adjustment. And if you’re having trouble with customers downloading those large files, get a dedicated IP address.
I would think that unless your wordpress is on a vps or dedicated server then you would be better off using soundcloud for audio and vimeo for video. This would be more ideal rather than using your own server resources to stream the media.
In fact, wouldn’t hosting video and audio on your site break many many hosting sites terms of service for Acceptable Use Policy on shared hosting plans?
Still a great post for those with the correct amount of server resources to dedicated to audio and video hosting! Thank you Jay!
This.
And also, if you are uploading vast files to your webspace, potentially you are slowing down your entire website, eating bandwidth and disk space and using up the server’s processor resources crunching your insanely-huge image files.
Yes, you can upload a photo straight off your phone to Facebook. That’s because Facebook has this great big PILE OF ADVERTISING MONEY to support all the processing of those photos in the cloud.
If you are running a small business website, you probably already have a computer that is more than capable of doing the resizing before you upload, can handle batching, renaming all the rest of it. If you expect your webserver to handle it, then you are using up resources that could be serving paying customers.
9 times out of 10, the answer to ‘i need to upload bigger files’ is actually ‘no, you need to learn about compression, think about how to make your website faster, and consider using a specialist video hosting channel’.
I came here to check how to *reduce* the max upload size. I have a busy charity site where volunteers are uploading stuff all the time, sometimes they forget and upload a 1 or 2mb image, which is unnecessary for the purpose of the site, eats disk space and bandwidth, and reduces performance. I shall be reducing max upload to 500kb, there is very rarely any need for uploads bigger than that.
Thanks for this post.
Been needing to do this. Tried the php.ini which didn’t work however .user.ini did work. Great job.
Mark
A really useful plugin to avoid these problems is ” Add from server ” that allows you to add big files to the library. You just have to upload them via ftp and then add them in the library menu. Next just remove the plugin for security issues. Hope this will be helpful !
Useful information for any WordPress developers or fresher. Thanks for share Jay
Thank you very much JH, very useful post.
Oh man Jay, thanks so much for the tutorial, I needed it…
Useful post!
If your site is hosted by GoDaddy, you need to add an action after editing your php5.ini file :
– Edit php5.ini like Jay said above :
file_uploads = On
post_max_size = 50M
upload_max_filesize = 50M
– Go to your GoDaddy dashboard, and click on “System Processes”.
– Click on “End Web” at the top left.
– That’s all. ๐
And don’t forget to remove phpinfo file named “info.php” at the end of the process.
Thanks for the tip!
I haven’t ran into this issue yet, but when I do i’ll now know how to fix it. Thanks for the great article!
Hi there Jay,
This is rather bizarre. Yesterday I did another local install and was trying to upload a theme and had the error message for maximum upload limit of 2mb. So after searching the web found a solution to modify the php.ini file which worked a treat.
I didn’t change the memory values or execution time which I will go back and do now.
Funny how quite often a problem has a solution here around the time that is required.
Thanks for the fantastic daily read, being in Australia it is the first thing I do when I’m up at around 5.30 and I look forward to these each day.
Cheers Greg.
PHP.INI works, the trick is to put it inside the /wp-admin/ directory