In this post we will know about how to increase upload file size limit in php.ini . By Defualt in php.ini the upload file size limit is 2Mb.If your website require the user can upload more than 2Mb of file in website or blog,this can be done by editing php.ini file.
In CentOS and Red Hat based Operating system,the path of php.ini file is /etc/php.ini
In Ubuntu and Debian based Operating system,the path of php.ini file is /etc/php5/apache2/php.ini
Use the command find to know the absolute path of php.ini file
find / -name php.ini
Here in this example we are increasing the file size upload limit up to 100 Mb. You can increase or decrease the limit in below given parameter as per your requirement.
Edit php.ini file and modify the given below parameter values as per your requirement.
file_uploads = On upload_max_filesize = 100M post_max_size = 100M max_execution_time = 300s memory_limit = 128M
file_uploads = To allow HTTP file uploads.
upload_max_filesize = Maximum allowed size for uploaded files
max_execution_time = Maximum execution time of each script, in seconds
memory_limit = Maximum amount of memory a script may consume (128MB)
post_max_size = Maximum size of POST data that PHP will accept.Its value may be 0 to disable the limit. It is ignored if POST data reading is disabled through enable_post_data_reading.
Restart the apache after editing the php.ini
You have to restart the apache web service to make the changes effective
/etc/init.d/httpd restart (In CentOS and Red Hat) /etc/init.d/apache2restart (In Ubuntu and Debian)
Leave a Reply