Product:
Search Type:

I am unable to send attachments through Webmail interface or upload big files via PHP scripts.

Article ID: 780 
Last Review: Oct,09 2007
APPLIES TO:
  • Plesk for Linux/Unix

SYMPTOMS

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.

CAUSE

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

RESOLUTION

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.

Additional information

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,

/etc/httpd/conf.d/php.conf:

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

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
*Please type the code you can see.
* - required fields