Saturday, 19 December 2015

How to increase upload file limit from 2MB to 10MB under Apache 2 UNIX / Linux web server?

php installation putting limits on upload file size. The default will restrict you to a max 2 MB upload file size. You need to set the following two configuration options:

Method # 1: Edit php.ini
Edit your php.ini file (usually stored in /etc/php.ini or /etc/php.d/cgi/php.ini or /usr/local/etc/php.ini):

# vi /etc/php.ini
Sample outputs:
memory_limit = 32M
upload_max_filesize = 10M
post_max_size = 20M

Save and close the file. Restart apache or httpd web server:
# service httpd restart
#chkconfig httpd on

Method #2: Edit .htaccess
Edit .htaccess file in your root directory. This is useful when you do not have access to php.ini file. In this example, /home/httpd/html is considered as root directory (you can also create .htaccess file locally and than upload it using ftp / sftp / scp client):

# vi /home/httpd/html/.htaccess
Append / modify setting as follows:
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M

Save and close the file.

No comments:

Post a Comment