Tuesday 14 August 2018

How to change the maximum file upload size in PHP by editing php.ini

By default php's maximum allowed file upload size 2MB.
In the php.ini file it is added as "2M".
In order to increase the default php's upload limit here are the needed changes.
Edit your php.ini file:
; Maximum allowed size for uploaded files.
upload_max_filesize = 50M
; Maximum size of POST data that PHP will accept.
post_max_size = 50M
Also it makes sense to increase the maximum execution time of the script because it'll need some time to upload a huge file.
I would recommend to add either of these lines into each script separately that is supposed to run a longer time.
set_time_limit(900); // 15 mins
or
ini_set(max_execution_time, 900); // 15 mins
Last, you may need to restart your web server.

0 comments:

Post a Comment