Edit .htaccess to increase PHP’s max file upload

//Edit .htaccess to increase PHP’s max file upload

Edit .htaccess to increase PHP’s max file upload

To increase the upload file size limit on your website, you need to edit PHP’s configuration settings. Unfortunately, not everyone has their own web server, so most of the time people are constrained by the limits of shared hosting. But you can still modify your base php.ini file by creating your own php.ini with the edits that you want.

Your php.ini file needs to be in every folder that’s going to be affected, or at least in the folder where the php script is being called from. Unfortunately if you have dozens of folders that need this edit, then you’ll need dozens of php.ini files.

An alternative is to then use .htaccess. By just placing a.htaccess file in your root folder, all folders beneath it will also have the change. The code to change your PHP max file upload size is:

RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000

You can edit it to suit your needs. 1000M = 1GB, so edit accordingly. Do note that your host will need to allow PHP edits though.

Similar Posts:

By |2009-09-23T03:59:49+00:00April 8th, 2008|Programming & Code|9 Comments

About the Author:

Alvin Poh lives in Singapore, and is interested in marketing, techy stuff, and likes to just figure out how the two can work with each other. He can also be found on Google+.


  1. adi wirawan August 7, 2008 at 10:28 pm - Reply

    thanks very helpfull my friend

  2. mary October 11, 2008 at 6:55 am - Reply

    I get error internal server error when doing this things.

    • Ichha January 17, 2010 at 11:03 am - Reply

      Same error

  3. faress January 2, 2009 at 6:58 am - Reply

    tankyou my friend you are the legend
    very tanks
    best wishes

  4. Lee October 16, 2009 at 10:42 am - Reply

    Cool. I’m going to try this out on the rackspace cloud.

  5. problem z rozmiarem zalacznikow March 17, 2010 at 7:55 pm - Reply

    […] dziaÅ‚a dla tych którzy maja problem jak ja Edit .htaccess to increase PHP’s max file upload | Alvin Poh's Blog pozdrawiam Odpowiedź z Cytatem   + Odpowiedz na ten temat […]

  6. […] M can be changed to GB as required. Information source URL: https://alvinpoh.com Posted in Ramblings | Tagged php Cancel […]

  7. Roch June 8, 2010 at 10:32 pm - Reply

    Do you know of anyway with htaccess to disable someone from using your domain to point to their own website on the same server? Ex: they use YOURDOMAIN.com to promote their PHISHING WEBSITE.COM by using this simple URL to send users : YOURDOMAIN.COM/~phishing/file.html

    Any help would be greatly appreciated. Thanks

  8. Alvin Poh June 9, 2010 at 12:25 am - Reply

    Do you know the URL in question? if you do, sounds like you could use a redirect command, like so: RedirectTemp /~phishing/file.html http://www.yourdomain.com

Leave A Comment