There is already a good answer for the question here.
Go to php.ini
file and change value with respect to your
requirements.
upload_max_filesize
By default this value is 2M. We need to increase it to the maximum
size of single file that we want to upload.
max_input_time
This sets the maximum time in seconds a script is allowed to parse
input data, like POST
and GET
. Timing begins at the moment PHP is
invoked at the server and ends when execution begins. This would
include populating $_FILES superglobal
.
memory_limit
This sets the amount of memory a PHP script is allowed to use during
its execution. Set this to a value greater than ‘post_max_size
’ so
that PHP script can load and process the uploaded file.
post_max_size
It defines the maximum size of POST data that PHP will accept. This
value should be greater than ‘upload_max_filesize
’.
max_execution_time
The time a script is allowed to run after its input has been parsed.
This would include any processing of the file itself.
If you are getting memory related error then turn off the output
buffering, the PHP configuration directive to be considered is
“output_buffering
”
output_buffering = Off
One thing I would like to add is to double check if the changes you made to the configuration file are live. To do that you can use the phpinfo function which will return all the configuration values in the current environment.
If the changes are not live, make sure to restart the server and/or check if you edited the correct .ini file which is also mentioned in the phpinfo output.