Support / KnowledgeBase

 
Search the KnowledgeBase Search

How do I increase the PHP upload limits?

  • Applies to: All (dv)

  • Difficulty: Medium

  • Time needed: 10 minutes

  • Tools needed: Root, vi knowledge

 
  • Applies to: All (dv)
    • Difficulty: Medium
    • Time Needed: 10
    • Tools Required: SSH, root access, vi knowledge

Symptom

I am unable to send attachments via webmail or upload big files with PHP scripts.

You are able to upload small files in webmail or with a PHP script, but larger files cannot be uploaded or you get "The page cannot be displayed" error when you push the "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.

This article has been mirrored from the Parallels Knowledge Base as a courtesy to our (dv) Dedicated-Virtual Server customers. As they are the authoritative source of the information covered in this topic we encourage you to check their original article since this content is subject to change.

(mt) Media Temple makes a best effort to ensure the accuracy of all content contained herein. Please use our feedback form below if you would like to report any inaccuracies. Please note that our feedback form is not an official support channel.

The publishing of this information does not imply support of this article. This article is provided solely as a courtesy to our customers. Please consult our (dv) Scope of Support for further information.
 

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

Solution

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

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

Save the file, then restart Apache.

/etc/init.d/httpd restart

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.

Resources


User Comments

No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article
Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue