The default upload file size for WordPress is 2 MB, which is a problem if you want to upload a large media files. If you get this error, “The uploaded file exceeds the upload_max_filesize directive in php.ini”, follow these steps:
- Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)
- Find this line in the php.ini file “upload_max_filesize = 2M” and replace it with a higher value (e.g. “upload_max_filesize = 64M”)
- You may also want to increase your max post size. Look for this line in your php.ini file “post_max_size” and increase it as well.
- Save the changes to the file inside your wp-admin directory.
- Try the upload again
- If you still have issues, look for this file in your root directory and make the same changes.
If you don’t have a php.ini file in your directory, you can usually generate one from the control panels of your host. BlueHost has the steps listed to generate a php.ini file.
If you don’t have a php.ini file in your directory and aren’t sure where to get one (or want to see where I made the changes in the code), you can download my php.ini file. I have already increased the upload_max_filesize and the post_max_size to 64M. Once this file is copied into your wp-admin folder, the problem should be solved.
A Comment From a User
Someone left additional instructions below in the comments. I thought they were hilarious (and accurate) so I moved them up here:
@ Anyone who knows enough about their hosted files to be dangerous (ie: you crash and uncrash your site with the click of a mouse on a daily basis goofing with it), but need baby steps to do this, here goes…
First, copy the text from the developer’s PHP file listed above. (yeah, it’s long…copy all of it….no, don’t change anything. Heck, don’t even read his notes if you get intimidated easily. Really, it’s cool….just copy it as is…)
- Get into your files via however you do it on your host (FTP, CPanel, Legacy File Manager, whatever).
- Navigate to wp-admin folder. Scroll down to see if you have a php.ini file in there. I didn’t, and if you didn’t add one at some point, yours wont either.
- I have CPanel access, so in CPanel’s file manager, click on ‘new file’. Name it php.ini. Save it. Now, find it and check box the file name. click ‘edit’. scroll down through the ‘blah blah’ about encoding. leave the default encoding selection. click ‘edit’. a blank screen will open. right click in the box and paste the developer’s code. Click ‘save’. (if you use something else other than CPanel, adjust as necessary….for FTP, create this all in notepad on your ‘puter, name it php.ini and upload to the wp-admin folder via your fave FTP program….)
- Go to your wp admin panel. navigate to ‘media’. click ‘add’. voila, your new ‘limit’ will read ’64MB’. Upload something big and hold your breath. Voila….if your host doesn’t have some imposed limit, your file should be there ready to edit!
- IF you messed up somehow and your site breaks, don’t freak out. Just go remove the php.ini file (either by deleting it or by renaming it so it doesn’t get read). Chances are you didn’t ‘select all’ and paste it right. Start over by deleting the text from the php.ini file you just created. re-copy the developer’s text and paste it again. Give it another whirl…
Thank you for your help, it worked perfectly!
Though in my version of wordpress, the php.ini file is situated in wamp\bin\apache\apache2.2.22\bin ,that’s why some people can’t find it in their wp-amin folder (and if they try to create one, it’s overrided by the previous one existing) !
Once again thank you for sharing!
Unfortunately I tried the new php.ini in wp-admin but am getting this error:
“Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
An ideas?
I just got the same error as Paul?
Thoughts?
Please try to restart your php. If you don’t have access to do that (on shared host), you could use htaccess instead of php.ini to increase upload_max_filesize, add following to .htacess
php_value upload_max_filesize 64M
php_value post_max_size 96
If that still don’t work, please consult your web host. Web host may have configuration that prevent you to increase file size
I just copied and pasted your php.ini file and it worked.
Thanks!
Wow, my issue is resolved.. Thanks a lot for sharing file to download.. You saved my so much time
Hi there,
Still at the early stages of building my website but just wanted to tell you what works for me.
1. php.ini was nowhere to be seen in cPanel/File Manager
2. I created a new file that I name php.ini (it’s a text file btw)
3. I pasted the following into it :
upload_max_filesize = 32M
post_max_size = 32M
4. I moved it to the root of the directory (in your home directory)
5. Refresh and voila your upload limit should now be 32M (check in WP Admin Panel/Media/Add and you should read 32MB)
Thanks everyone for your precious help!
Nico.
I literally spent hours on the interweb scouring for insight into this issue. It took a while for me to figure out that you meant to create a “FILE” not a “FOLDER”, but I am fairly new to this whole thing. Once I got that down everything went smoothly. Thanks, your advice was the best I could find on the net.
Obrigado pelo tutorial, ajudou bastante!
Hi
I used your bluehost method. Thank you.
Is there a reason we dont upload more than 64MB.
Can I change it to 500 mb?
Thank you for posting your own php.ini with the max upload already increased. I am glad to see such a well-commented file, and I wonder why it was not included in the wp-admin directory in the first place.
Hello everybody,
My problem is that my php.ini file only contains the words: safe_mode = off;
Can anybody help me? Should I create a new php.ini file?
Would appreciate any help!
Thanks a lot, I love it when someone answers a question so clearly and it fixes the problem. Cheers.
I have copied the PHP.ini file above to my wp-admin folder and wordpress root folder and done an IIS reset, still the upload remains 2mb
Hey, many thanks. It’s been 2 days since I got this problem. It’s solved after I download and upload your php.ini file to my wp-admin folder.
I can’t get it to work I loaded your code into the wp-admin file using cyber duck and refreshed the server and the browser and still nothing. Am I doing something wrong?
Yeah, not getting this to work either. I copied and pasted everything from the link. I refreshed the cPanel, and nothing. Anything else to try?
That’s the key! To put the php.ini files in wp-admin! Everywhere else DOESN’T work. At least not for the site I was working on.
After changing /etc/php.ini I needed to restart Apache before the change was honored. On my system:
sudo service httpd restart
Thanks Devin, your share really help me
Thanks!! you helpt me a lot!! Greetings from Holland!
It didn’t worked for me :( I did everything right and I can see de php.in file in my FTP folder and everything but the size limit in my wp still the same and I can’t upload my theme.
I’ll try tomorrow with my host provider…
This is really helpfull
Thanks for sharing
make some php.ini at wp-admin on file manager cpanel
write content
upload_max_filesize = 32M
post_max_size = 32M
done. no one else.
yiipiiiie
I looked for this over and over and everyone had an answer that didn’t work. WPTheming is my new best resource! I’ll be checking you guys out.
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
thanks Sam, the bin\php folder was the one i needed.
Thanx :) I updated my max Filesize just because of you
I can’t get it to work. I have two WordPress sites installed. One gives me 2MB upload and the other just 1MB. I’ve tried everything that’s been suggested, but to no avail. :-(
Hey, just be sure that your file is php.ini (.ini extension)
I was failing because I used Dreamweaver to create the file and it was saved as php.ini.php. Note the php extension at the end of the file name.
Inside this file, just copy and paste the text below:
upload_max_filesize = 80M
post_max_size = 80M
Once you have it created, upload it to the folder wp-admin.
That would be enough.
are you trying to install on AWS EC2 server?
I am and having no luck – even with FTP!
The file won’t upload on Filezilla – the transfer keeps failing.
I am quite new to this so any help with this would be awesome!
I had this problem too. I had the php.ini file in the root folder. I moved it to the wp-admin folder, uploaded it and then rebooted the server. Then it worked.
I have change it upto 200M but still cannot upload my theme
This worked perfectly for me. Thank you so much!
Hello Author I tried it but i am getting same error ! I am using a trial web hosting account, so is this problem cause of it ?
Hi i pasted your php.ini and my website get this error: “Too many redirects”, i’m using https://
Hey Guys,
SO if you have Media temple then the php.ini file is in your root directory under /etc (not under your wp admin for the one worpressfile)
this may be a very old thread, but it was helpful to me thanks – however, I did find that my hosting company has a PHP setting with a file upload max size that I think is overriding what is in my php.ini file – this may be why it is not refreshing for some of you as well.
apologies if this has been said already
This was a lifesaver, thank you SO very much.
I have created a plugin that very easily changes the max upload size in any PHP configuration – by using chunked upload. It splits the file into smaller chunks, and that allows you to upload any filesize.
https://wordpress.org/plugins/wp-awesome/
Please check it out and give me any feedback or bug reports and I’ll promptly fix them.
1. I tried to download the php.ini file above and place it to wp-admin/(here). But it didn’t work.
2. So I created a new file named php.ini with “upload_max_filesize = 32M
post_max_size = 32M” inside, still didn’t work.
3. Then I tried to edit .htaccess and add
php_value upload_max_filesize 64M
php_value post_max_size 96M
it worked :D
This helped me
I searched for “.htaccess” and simply pasted this, none other solutions worked
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
For those who still cannot do this. In your CPanel UI got to Software–>Select PHP Version. Here you can select a php version you currently have in the dropdown (Just make sure the version you select does not say default). Now you will see many checkboxes, and in the topright corner a link that says “Switch To PHP Options”. Click that link. There you will see the so called “upload_max_filesize = 80M
post_max_size = 80M” options. Change them to your liking & save.
Chris, YOU ROCK! THIS is the answer!
Finally it works!!!!
Chris, amazing help!
anything else worked, except your solution!
Thanks,
have a nice new year :)
Hi Chris, thank you for the help. Your instructions worked for me. All others didn’t. I’ve been working on this problem for hours. Cheers!
None of this was working even after increasing the file size to 128MB! So, I uploaded the pro zip file to the wp-content/plugins and extracted it. Then I installed it through wordpress plugins. So far, so good.