How to change the PHP Upload Limit

Usually your hosting package limits the amout of data you can upload to 2MB, which isn’t enough for most of us. It’s good for that 200k photo, but say you’re uploading a 4MB audio clip, a video or a large PDF, you’re stuck.

Fret not my friends, for help is at hand! Put the following code in your .htaccess file and smoke it:

php_value upload_max_filesize 100M
php_value post_max_size 100M

Instead of “100M” you can choose any limit you like, say 5M, 10M or whatever limit you like.

If you can’t find the .htaccess file, it might either be that

  • your FTP client doesn’t display hidden files; make sure that it does
  • or it doesn’t exist (in which case, create a plain text file, upload it and name it .htaccess)

If you’re having trouble, just download this file. Then simply unZIP it and upload the contents into your WordPress directory. Once it’s on the server, rename it to .htaccess and you’re done.

Good luck ๐Ÿ˜‰

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

23 thoughts on “How to change the PHP Upload Limit

  1. Doesn't work for me. If I insert those lines in the dot-htaccess file, WP doesn't work at all (gives me a Bad Configuration Error). Any ideas?

    Inside the dot-htaccess file are these lines already. I put your code at the bottom (under the last # END WordPress comment):

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    1. Hi Tom,

      sorry to hear that. I'd put the php_value statements at the very top of that file.

      The current contents makes it possible for WordPress to use "pretty permalinks". If all else fails, delete everything in the .htaccss file, make the file writeable and add the php_value statements I've given you. Then go back to Settings – Permalinks in WordPress to update the rewrite structure.

      Good luck ๐Ÿ˜‰

  2. 500 Internal Server Error
    "The server encountered an internal error or misconfiguration and was unable to complete your request."

    .htaccess has full permissions (777), the two lines are right on top and I can't get to Settings – Permalinks to update the rewrite structure because I can't get to anything at all with the error.

    1. Steven,

      depending on the text editor and FTP Client you're using, the file can get screwed up.

      I've uploaded this sample .htaccess file to get you started. UnZIP it, upload it to your server, then rename it .htaccess and change the file permissions to 777 for the permalink structure. That'll eliminate any errors that may have happened during the editing of that file.

      If that doesn't work, it must be your FTP client. Make sure it's using BINARY mode when uploading files to your server.

      Hope this helps ๐Ÿ˜‰

      1. Hi Jay,
        I've tried each of the various methods you describe above to try and get the htaccess file to work, but I'm having the same trouble that Tom S describes above. I finally downloaded your sample.htaccess file and uploaded, then renamed it–but I get the same error. Hmmm. On another, separate thread elsewhere I see a similar kind of workaround being employed on the php.ini file: I tried all of those as well–I don't get the errors, but it doesn't change the 8MB maximum upload limit. This is very frustrating, as I have a client who needs to upload a large audio file and we can't do it.

        1. Tricky one. Let me see if I get this right: without any .htaccess file, all is well but your upload limit is 2MB (or the default PHP Upload Limit) correct? And when you amend the .htaccess file as I suggested or upload my sample file, all you get is a 500 internal server error, right?

          Then the only explanation that makes sense is that the FTP client is screwing it up. Or, your server does not run Apache as a web server.

          There's one other way you can add the file and the settings if you have SSH access to your server. Are you running your own server?

          I can always do this for you if you get stuck:

  3. Where exactly would I add that to my .htaccess

    Below is what is in there at the moment. How should it look after I add the code?

    Thank you so much.

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    1. Hi Thomas,

      Those are the WordPress rewrite rules for Pretty Permalinks, make sure you don’t erase those. Add the other code at the very top of the file (before #BEGIN WordPress) and you should be golden.

      Hope this helps ๐Ÿ˜‰

    1. Some hosts won’t allow you to override this, however it should not cause an internal server error.

      Some FTP clients screw this file up when you upload it, you can test this by downloading the file again and having a look in your text editor. It could also be your text editor – make sure you DO NOT USE Word or Pages for this, it has to be Notepad, Write or Text Edit. Your FTP client needs to transfer this file in ASCII.

  4. Yes, I followed the same instructions, but got the following when I tried to load my website:

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    Any thoughts?


    1. I’m afraid not Joe,

      other that what I’ve already said in a previous comment. Some hosts don’t allow .htaccess overrides so that could be an issue. And make sure that your FTP client uploads the file correctly (you can check by downloading the file again and comparing it to the text file). Also, don’t use Word or Pages to edit the file – it has to be a plain text editor (like Notepad under Windows or Text Edit in Mac).

      I’d say get in touch with your hosting company and ask them to be 100% sure.

Add your voice!