PHP Increase Upload File Size Limit

In group: Community Design & Support
PHP Increase Upload File Size Limit
 
How do I increase upload file limit from 2MB to 10MB under Apache 2 UNIX / Linux web server?


Your 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:

upload_max_filesize - The maximum size of an uploaded file.

 
post_max_size - Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.
 
memory_limit - This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
 

There are two methods two fix this problem

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 lighttpd web server:

# service httpd restart

OR
 
# service lighttpd restart
 
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.
 
Remember if your mooSocial website is in a subdirectory like community eg [http://yourDoamin/community/] then you will need to still make sure your .htaccess file is at the top level ROOT directory not in the subdirectory!
 
Just remember that in your admin cp, the image files upload are set to:-
Photo Image Sizes (?)
75_square|150_square|300_square|250|450|850|1500
 
1500 being the largest.
 
#uploadFileSize
 
Posted in on 02/10/16 at 08:14
Comments (0)
No login
Login or register to post your comment
Cookies on mooCommunity - Social Networking Script.
This site uses cookies to store your information on your computer.