Increasing the maximum post size

PhpApache

Php Problem Overview


There is a lot of data being submitted no file uploads and the $_SERVER['CONTENT_LENGTH'] is being exceeded. Can this be increased?

Php Solutions


Solution 1 - Php

There are 2 different places you can set it:

php.ini

post_max_size=20M
upload_max_filesize=20M

.htaccess / httpd.conf / virtualhost include

php_value post_max_size 20M
php_value upload_max_filesize 20M

Which one to use depends on what you have access to.

.htaccess will not require a server restart, but php.ini and the other apache conf files will.

Solution 2 - Php

I had a situation when variables went missing from POST and all of the above answers didn't help. It turned out that

max_input_vars=1000

was set by default and POST in question had more than that. This may be a problem.

Solution 3 - Php

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

Solution 4 - Php

You can do this with .htaccess:

php_value upload_max_filesize 20M
php_value post_max_size 20M

Solution 5 - Php

We can Increasing the maximum limit using .htaccess file.

php_value session.gc_maxlifetime 10800
php_value max_input_time         10800
php_value max_execution_time     10800
php_value upload_max_filesize    110M
php_value post_max_size          120M

If sometimes other way are not working, this way is working perfect.

Solution 6 - Php

You can increase that in php.ini

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Solution 7 - Php

You can specify both max post size and max file size limit in php.ini

post_max_size = 64M
upload_max_filesize = 64M

Solution 8 - Php

I had been facing similar problem in downloading big files this works fine for me now:

safe_mode = off
max_input_time = 9000
memory_limit = 1073741824
post_max_size = 1073741824
file_uploads = On
upload_max_filesize = 1073741824
max_file_uploads = 100
allow_url_fopen = On

Hope this helps.

Solution 9 - Php

Try

LimitRequestBody 1024000000

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDanielView Question on Stackoverflow
Solution 1 - PhpJohn GreenView Answer on Stackoverflow
Solution 2 - PhpRandomWhiteTrashView Answer on Stackoverflow
Solution 3 - PhpMuhammad ZeeshanView Answer on Stackoverflow
Solution 4 - PhpRJD22View Answer on Stackoverflow
Solution 5 - PhpNeel ThakkarView Answer on Stackoverflow
Solution 6 - PhpIvan LazarevicView Answer on Stackoverflow
Solution 7 - PhpNathanDView Answer on Stackoverflow
Solution 8 - PhpahmedView Answer on Stackoverflow
Solution 9 - PhppavelView Answer on Stackoverflow