'How to increase the PHP upload limits [duplicate]

When i try to upload database it comes an error saying:

You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.

Does any one know how to fix this?



Solution 1:[1]

By default, PHP is set to allow uploads of files with a size of 2MB or less.

so try this in your php.ini file.

Note : post_max_size is the answer for your question. however try to change them too. this may help in future.

memory_limit = 99M
max_execution_time = 300
upload_max_filesize = 20M
post_max_size = 24M

Solution 2:[2]

For increase the PHP upload limits - You need to configure in php.ini file in your apache root directory.

upload_max_filesize = 10M
post_max_size = 10M

Once after configuration, you need to restart the apache server. You can also verify the same with <?php phpinfo();?>

Also, If handling large files for uplaod and need to be consider about the max_execution_time, memory_limit and max_input_time configuration as well

Solution 3:[3]

See options:

upload_max_filesize = 120M
post_max_size = 120M
max_execution_time = 200
max_input_time = 200

Update PHP.ini or use init_set to change limit on php file like this:

ini_set("upload_max_filesize","120M");

You can set more than 120Mb, it is the limit.

Also you can set the value on .htaccess file:

php_value upload_max_filesize 120M

Solution 4:[4]

Seems like you hit the limit whist uploading your Huge SQL... Instead of playing around with PHP.ini settings... Make use of BigDump

Staggered import of large and very large MySQL Dumps (even through the web servers with hard runtime limit and those in safe mode). The script imports only a small part of the huge dump and restarts itself. The next session starts where the last was stopped.

This is really handy when you are on Shared Hosting.

Solution 5:[5]

To increase the maximum upload size, open php.ini file and change the values of upload_max_filesize and post_max_size directives to the desired value. For example:

upload_max_filesize = 64M
post_max_size = 64M

Save you php.ini file and restart your web server. If you do not have access to the php.ini, contact your system administrator or hosting provider to increase these values for you. You can point out that they need to be applied to the /public folder. Do not forget to restart your server after the changes in the php.ini have been made. If you skip this step, the maximum upload size change will not be applied.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mahesh
Solution 2
Solution 3
Solution 4
Solution 5 Guru