Agaric Design Collective

Maximum upload size in PHP and Apache

 
By Benjamin Melançon
on 09 Jul
1 comment

Maximum file size upload problems, please help!!!
http://drupal.org/node/157174

If you have access to php.ini or you are allowed to use a modified copy of php.ini, add two lines like the following at the end (example for 16MB files)

upload_max_filesize = 16M
post_max_size = 18M

If you can't use a php.ini, then you can add two lines in your .htaccess file

php_value upload_max_filesize 16M
php_value post_max_size 18M

[On the Drupal file upload settings page]

you get:
- no more that what upload_max_filesize says
- no more than half of post_max_size
(whichever is smaller)

So, the right numbers for up to 32MB files seem to be:

upload_max_filesize = 32M
post_max_size = 64M

This is just an empirical observation without any knowledge of what is going on. Not sure if it applies always.

CogRusty is wonderful.

See also Agaric's quick and drastic increase of file upload limits in PHP.ini.

 

Stefan explains how the various places for these settings work

The availability and power of the .htaccess file depends on the Apache
configuration. The directive AllowOverride controls what can be
overwritten in .htaccess files. Some of the configuration directives in
Drupal's .htaccess file also depend on the version of mod_php but we use
FastCGI. As we are using Lighttpd on the test server it does not have
any effect at all.

In the global php.ini one can restrict overriding php config options at
the webserver and application layer. In our configuration their aren't
any restrictions.

I recommend to have all settings in the per site virtual host
configuration.

Posted by Benjamin Melançon on Wed, 2009-05-27 10:37
Post new comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <small> <pre> <strike> <sub> <sup> <kbd> <s>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.