SquirrelMail English Site Danish Site French Site Russian Site Japanese Site 
News
About
Support
Screen shots
Download
Plugins
Documentation
Sponsors

PHP sets limits on how large attached files can be. To change this limit, you need to edit the php.ini configuration file. The values you will need to increase or decrease are:

The values can be set in bytes (1,048,576 per MB) or they can be set in MB by appending the value with an "M", ie. 8M.

To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. ([1])

You should also take into account limits for your MTA software:

  • Courier-MTA: showconfig or /etc/courier/sizelimit - default 10MBytes
  • Postfix: a configuration parameter called message_size_limit in the file /etc/postfix/main.cf sets the maximum size (in bytes) of the entire message - default: 10240000 - i.e. approximately 10MBytes
  • Qmail-MTA: a file in /var/qmail/control called databytes. The file contains one line that represents the max size of attachments in bytes.
  • Sendmail: option MaxMessageSize, usually unset; can be changed in mc file define(`confMAX_MESSAGE_SIZE',`5242880')dnl

Pay attention if you use any proxy server like Squid. In Squid, you need to change the request_body_max_size. The default is 1MB.

eg: request_body_max_size 10 MB

In some versions of squid this is called request_size rather than request_body_max_size.

And your HTTP server:

search for /etc/httpd/conf.d/php.conf and comment out LimitRequestBody

<Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
#    LimitRequestBody 524288
</Files> 

RESTART Apache 2.0 - and you will be able to attach filesizes > 0,5M again.

SquirrelMail in a first step try to stop user to submit attachment bigger than allowed using <input type="hidden" name="MAX_FILE_SIZE" value="1000"> HTML code, which do not work with all browsers, but the question is: With which browsers work and with which do not work? Please report it here.

  • Konqueror seems not to obey this limit.
  • Mozilla seems not to obey this limit.
  • Microsoft Explorer seems not to obey this limit.
so is there any working, or code is broken?
kink: I think this is an error in the PHP documentation, because I couldn't find a single browser which does something with this limit.
tokul:> Firefox (1.0 Debian Sarge) follows it, but interface can't rely on restriction that is controled by end user.

Related bug: [no 597206]

Probably the problem with memory starvation with big files is not a SquirrelMail problem but a PHP problem, seems to be solved since PHP 4.2.0, look at: [php bug 17606] (not sure anyway).

If you have any problems with this, see the PHP documentation at http://www.php.net/ (here's the relevent page[2])

Problem noted on Red Hat 8.0/9.0 with Apache 2.0.x, the error "Requested content-length of 670955 is larger than the configured limit of 524288" was occuring under Apache and a "Page not found" would appear in the browser. Trying the above settings made no change with PHP, but on Red Hat 8.0/9.0 there is an additional PHP config file, /etc/httpd/conf.d/php.conf}, and increasing the number on the line {{LimitRequestBody 524288 solves the issue.

Gentoo Linux has a file like the above mentioned where the limits are set, the file is /etc/apache2/conf/modules.d/70_mod_php.conf.

As a side note, check the max execution time in php.ini. Very large attachments may take longer than the 30 seconds allowed. Symptoms may be found by looking at the httpd error log and seeing "httpd in free(): warning: recursive call" yet the httpd does not core fault and die altogether. For a 10 MB file attachment I set execution time to 120 seconds.

Gentoo Linux - Update - Actually, I did not find the *mod_php.conf file in Gentoo Linux had any of the above information. I modified the /etc/php4/php.ini file as directed. Though, I did find a link to this file in the apache directory under /etc/apache/conf/php.ini.

The file that needs to be adjusted in the Red Hat 9 configuration of Apache 2.x is in /etc/httpd/conf.d/php.conf. The paths given above are inaccurate, at least for Red Hat 9. This solves the Apache interference, but is not the only limiter on large files.

Gentoo Linux: After raising the above mentioned values to 10M in php.ini, you do need to change LimitRequestBody in /etc/apache2/conf/modules.d/70_mod_php.conf! I put mine to 2097152, which is equivalent to 2M. This way, I can limit each attachment file size to 2M while the message size is 10M.

IMPORTANT: You must restart Apache before any changes take effect.

After setting memory_limit, post_max_size, and upload_max_filesize to 100MB in php.ini, and setting LimitRequestBody to 0 (unlimited), restarted the Apache, I found that file_manager was reporting that the maximum upload file size was 50MB. Is this hardcoded in?


Fedora Core 4:

I followed the above description and it worked. But then my server started crashing. It's crashed several times in the past two weeks. I am forced to hard boot the box, which is a real pain in the ass given it seems to only happen when I'm out of the office. So: THIS FIX IS BUGGY IN FC4!!

EDIT: these configuration file changes can't cause a server failure. However, it's possible that your web server is crashing with big files. That would be very strange and a big bug in your web server, and both Apache 1x and 2x bundled with FC4 don't have any trouble there. If your server is hard crashing, there's something else wrong. Take a look at /var/log/messages or read the trace on the screen before rebooting.

© 1999-2007 by The SquirrelMail Project Team