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…
Looks like BlueHost does not allow major over rides of max file size:
http://www.bluehostforum.com/showthread.php?662-Command-To-Restart-Apache
I am 10 mb max
thanx man….. it worked for me….
I found if we use WP Filebase plugin, we can upload upto 31 mb file with it and without any further settings.
Had this problem a few weeks ago and this is exactly what I did on my host, it is important that you put the php.ini file inside your wp-admin folder though – this worked fine for me.
Elliott’s answer did me fine too. I’m also on Lunar Pages.
I just connected to my site via FTP, then put the sample php.ini file with the memory already set worked great. BTW as far as I could tell, there was NO php.ini file in there in the first place.
Thanx all for sharin’ yer wisdom…
Thanks this worked fine!
Adding the sample php.ini file worked for me…my site is hosted on Lunar Pages. Thanks for sharing it!
I am using Microsoft webmatrix, and added the phi.ini files and the WPfilebase plugin, but nothing worked…can anyone help me?
These instructions would just work on an Apache server. I’m not sure how you would bump filesize on a Windows machine.
Jacqueline & others having issues uploading themes or other files over 2MB to Azure – this thread provided the simplest fix I have yet found on this subject: http://social.msdn.microsoft.com/Forums/en-US/windowsazurewebsitespreview/thread/06e57c7d-187f-4468-8ab3-2fe7e28f1aa4
The fix is:
[1] creating a file in a text editor, calling it .user.ini
[2] pasting this into it: upload_max_filesize = 8M
[3] saving it and then uploading it to the root of the site [wwwroot].
I chose the 8M over other possibilities because there are reports that 8MB is the maximum allowed on Azure Web Sites at the moment.
Hope this helps,
Luca
FYI: Working on a Windows machine with “Microsoft Webmatrix”. The above solution did not work by adding a php file in the wordpress directory.
However: I found the php.ini file on the following location:
C:\Program Files (x86)\IIS Express\PHP\v5.5\php.ini
editing the file with the settings (I used 64M). Restarted the website and worked perfect.
upload_max_filesize = 64M
post_max_size = 64M
worked perfect for me! just downloaded your php file (however I renamed it “php.ini” because it’s called “php.ini.ini” uploaded via cyberduck, and it worked!
big thanks.
I use ipage hosting and just put two lines in a php.ini file
upload_max_filesize = 32M
post_max_size = 32M
and it works fine!
Yup that works for me too
Yes, step 1: Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)
You’ll need to create or download the php.ini file if it doesn’t exist.
i am using 1freehosting.com wordpress
after uploading php.ini in wp-admin folder uploadd file size
change to 64 mb it still 8 mb
Using WordPress 3.3.2.
Worked like a charm creating a new php.ini in wp-admin, via the cpanel file manager, editing it and filling it up with the default php code, like suggested. Thanks!
WordPress 3.3.1 Apache on WAMP development server
Followed instructions but kept having limit of 2M. Finally located another php.ini file here: \wamp\bin\apache\Apache2.2.21\bin.
It had the 2M limit that must have been overriding all other settings.
Just found your page and followed instructions. You saved my tail! You rock!!
This worked perfectly for me. Thank you so much! WP 3.4.1
“First, copy the text from the developer’s PHP file listed above.”
–How to I get the php.ini file to copy in the first place? Where is it located? I’ve been browsing through my cpanel’s file manager to no avail.
Thanks.
Ftp’d the php.ini file and installed Nova theme perfectly in the required directory: wp-admin folder.
To get php.ini file, you need to right-click on the link, then select “Save link as…”
Thanks, to the OP!!
.htaccess worked for me, php.ini did not.
I did the test here locally, as friend Tim G. recommended, and it worked! First I was only testing with the first line: “php_value upload_max_filesize 120M”. It did not work well, only increased from 2MB to 8MB. I did it because I wanted to just increase the maximum size for files, thinking they were not needed 4 lines changes, only one, but I was wrong. I was curious.
For GoDaddy, you will need to create a file in the root directory called “php5.ini”. Copy the code, refresh your WP Admin screen and voila, you can now upload up to 64MB! Also, note that GoDaddy allows you to increase your upload size to max 192MB. This worked like a charm. Thanks for this great info!
Thanks, Devin! I seriously appreciate you working this out. I’ve been having this issue with multiple client sites. Now, I can breath easier now. I’m totally gonna spread the word.
Thanks for this! I knew how to increase the PHP memory limit in WordPress but your post helped me migrate a large blog full of content using the WordPress importer.
Tim G’s response about editing the .htaccess file worked perfectly, downloading and uploading the php.ini didn’t.
I’m on GoDaddy. Had to rename file to php5.ini and load into /wp-content/themes/xxx-child directory.
thanks!
Tried the php.ini option and no change. The upload limit didn’t change in the Add Media option, and uploads failed. I think there is faulty syntax in your php.ini file. At least in Coda, half the file comes out in green, as if it was commented out. I don’t know enough to know where the fault is. For me, adding to the .htaccess file throws a 500 Internal Server Error
For anyone running WordPress from there own Wamp server in January 2013, here’s what worked for me. I’m a newbie though, so I have no idea otherwise…
First of all, ignore all the above posts about uploading a php.ini file to WordPress :)
I changed two copies of php.ini on my computer.
There is a copy in each of these directories.
C:\wamp\bin\apache\apache2.2.22\bin
C:\wamp\bin\php\php5.4.3
Restart WAMP and hopefully you’ll be good to go.
For anyone running WordPress from there own Wamp server in January 2013, here’s what worked for me. I’m a newbie though, so I have no idea otherwise…
First of all, ignore all the above posts about uploading a php.ini file to WordPress :)
I changed two copies of php.ini on my computer.
There is a copy in each of these directories.
C:\wamp\bin\apache\apache2.2.22\bin
C:\wamp\bin\php\php5.4.3
Restart WAMP and hopefully you’ll be good to go.
—- how did you changed the php.ini on both directories? you just simply copy+paste it or you just change some codes?
In my case I just changed the values manually in each (though I guess they should be the same file to start with on a fresh install).
(i.e. both values, in steps 2 and 3 –
2. 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”)
3. 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.)
By the way, there are probably several places to find this info, but I used a PHP in-built function to give all the settings for my computer server setup along with the active php.ini file.
You can easily put this one line in a PHP file e.g. name it my_phpinfo.php:
Place this file somewhere in your www/sites directory and if in the root, for example, for a browser in Windows type localhost/my_phpinfo.php
In my case with WAMP the “loaded configuration file” was:
C:\wamp\bin\apache\apache2.2.22\bin\php.ini
I just googled my solution and I found wordpress.org/support/topic/change-maximum-upload-size-and-find-phpini
Apparently you should never keep this file accessible on a production server as you’ll be giving hackers way too much information.
The published advice from a user comment worked brilliantly for me; I created the file in cPanel as advised, then dragged the created file into my FTP program & it solved the problem in an instant! Fantastic!
your php.ini file worked for me :) thanks
I’m running 3.5.1 with FatCow and your php.ini file worked like a charm! THANK YOU SO MUCH! I’ve been racking my brain for days trying to figure this out!
Hey, great feature this, I just uploaded the latest WordPress 3.5.1. and had this issue, I downloaded your ini file and uploaded it and it worked fine. Thanks very much.
I’m hosting with HostZil.la Premiun Cloud and it works when I uploaded Devin’s php.ini. Thanks!
Great info for i-page users.
http://andrewapeterson.com/2011/02/ipages-secret-php-ini-editor/
Ok I have 3.5.1 and just found the answer on this guys forum. He has the files already created. A great explanation also. Really simple just upload his two documents into your wp-admin folder and you are done.
Link Here:
http://thescriptingblog.com/wordpress-max-file-upload-size-increase/
THANK YOU!!! This error could’ve caused me a lot of problems but your article helped. I used the php.ini file and it worked a treat :D
Can you update your post to say this only works for Apache users? Lots of time spent trying this on Microsoft Web Matrix before I read the comment that it is only for Apache. Still, thanks for helping others.
For Windows Users see this link:
http://wordpress.org/support/topic/where-is-this-annoying-phpini-file
Be file to edit just the upload_max_filesize in the php file and not to overwrite the entire file with the php.ini file provided elsewhere as this might break your installation of wordpress.
The php.ini file should be in your program files directory:
C:\Program Files\IIS Express\PHP\v5.x\php.ini
The “x” simply represents whatever version of PHP was installed.
Windows by default hides system files. A *.ini file might be considered system and not show up in Windows Explorer… So go into the php folder using a command prompt window and enter:
notepad.exe .\php.ini
Using a phpinfo file should tell you the path to the .ini file.
If you are not familiar with php it may then be advised to use great care in editing your php.ini file.
.htaccess worked for me! Unfortunately php.ini did not.
Wow! Thank you so much for the file and for the step-by-step instructions for the freaked out!
Has completely solved the issue I was having.
Just to say thank you for this information. A client of mine use Strato hosting, and was able to use your php file to make changes to wp media capacity.
thank you for your help.
I also wanted to thank you for this post! I can also, verify that this worked even with wordpress 3.6!
The “A Comment From a User” worked perfectly for me :) Working on a client’s site on crazydomains which had a 2MB limit. This fixed it soooooo easily!
THANKS~!
You are a Golden God. Please take over all WordPress troubleshooting from now until the end of time, new favorite person. Seriously you saved my whole day!
Has anyone solved this for WordPress running on Nginx?
Worked for me just dandy! Thanks for sharing!
The uploaded file exceeds the upload_max_filesize directive in php.ini. (Solution)
http://www.docstorus.com/viewer.aspx?code=d8afbfe6-b000-4bbb-9bbd-7b511d10608e
I’d just like to say – thank you.
Your fix worked perfectly.
worked like a charm. thanks. I use fastwebhost.com.
THANK YOU!!!!!!!!!!!!!!!!!!!!!!! It worked! I have been struggling with this issue, since the first update to my theme last summer. I just gave up and lived with whatever it was that wasn’t upgraded, but when the second upgrade came, I decided I had better conquer this error. I know nothingabout PHP, etc. I just use WordPress, so most solutions were far too technical for me and my Theme provider offered no solutions. This worked and I could figure it out fairly quickly. Once again thank you!
Brilliant! It worked! Thanks to you and to the kind person who wrote the “baby steps” instruction.
Devin! Thank you so much! I uploaded your php.ini file to my wp-admin folder and it works like a dream. Had an afternoon of contacting my host who literally said “search the internet” when i asked them if they could help me locate the php.ini file (turned out i didnt have one).
Works like a dream and I am very thankful! I have a few items with 4 or 5 variables each so 5 variables, multiplied by 4 variables multiplied by another 5 gives a lot of options and when I was saving products half of them wouldn’t save! until now!
“Searching the Internet” is always a good first move. :)
Glad it worked for you.
This didn’t work for me, but using PLESK control panel, I could change the PHP settings. This must essentially do the same thing as a PHP.INI file on a shared server.
Tony,
its working fine for me!!