Article ID: 780, created on Oct 6, 2008, last review on May 11, 2014


You are able to upload small files in Webmail or with some PHP script, but big files cannot be uploaded or you get "The page cannot be displayed" error when push "Send Message" button. If error reporting is enabled you receive the "Allowed memory size of 8388608 bytes exhausted (tried to allocate 0 bytes)" or "Request Entity Too Large" error.


PHP has several configuration options to limit resources consumed by scripts. By default PHP is configured to upload files with size up to 2MB.


Try to increase the following values in /etc/php.ini, for example:

memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 12M

and restart Apache.


If the upload_max_filesize is larger than post_max_size, you must increase post_max_size so that it is bigger than upload_max_size
If the value of post_max_size is larger than memory_limit, you must increase memory_limit so that it is larger than post_max_size.

Parameter 'LimitRequestBody' in apache configuration may also be checked and increased if necessary on some OSes. For example,


# Cause the PHP interpreter handle files with a .php extension. # <Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
    LimitRequestBody 524288

Email subscription for changes to this article
Save as PDF