Where do I set the maximal POST length in PHP? [duplicate] - php

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

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.

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.

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

You can do this with .htaccess:
php_value upload_max_filesize 20M
php_value post_max_size 20M

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.

You can increase that in php.ini
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

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.

You can specify both max post size and max file size limit in php.ini
post_max_size = 64M
upload_max_filesize = 64M

Try
LimitRequestBody 1024000000

php.ini
Change setting max_input_vars from default 1000 to 10000 for enought json post data.
It worked for me.
max_input_vars=10000

Only add the below 3 lines in .htaccess file, which is in your root folder of the project.
php_value memory_limit 500M
php_value post_max_size 500M
php_value upload_max_filesize 500M
It will completely assist you in resolving your problem.

Related

How to fix connection was reset error in laravel 6

I use Laravel 6.2. I try to upload a video. The size is ~700mb, but when I submit the form I receive the following error in Chrome:
The connection was reset
I tried to upload a video which has ~5mb size and it worked fine.
I disabled XCache, but it did not work.
P.s: Post_max_size and upload file size is 2gb
Try the following:
Apache: Edit your httpd.conf file, and increase max_execution_time as well as max_input_time:
<Directory "[path/to/this/directory]">
php_value upload_max_filesize 2000M
php_value post_max_size 2000M
php_value max_execution_time 600
php_value max_input_time 600
</Directory>
PHP: you can also increase time and size in your php.ini file:
post_max_size = 2G
memory_limit = 512M
max_execution_time = 36000
max_input_time = 60
Then, restart your Apache server and try again.

Changing the max_upload_filesize in php.ini but it stays the same in phpMyAdmin

I am dealing with the following problem, as i described at the title, I am changing the max_upload_filesize in php.ini in order to upload my database but the settings in phpMyAdmin stays the same.. Any ideas why this is happening??
I have this problem a month and i have to find a solution.
Thank you in advance!
Try these different settings in C:\wamp\bin\apache\apache2.2.8\bin\php.ini
Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
Change to:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
And Restart your server
When you change upload_max_filesize value you should also change post_max_size value.
; Maximum allowed size for uploaded files.
upload_max_filesize = 15M
; Maximum size for a POST REQUEST (This value MUST be greater than
; upload_max_filesize)
post_max_size = 30M
Also memory_limit value must be grater than post_max_size.
Check this

Contact form 7 file upload not sending mail

Hello and thanks for reading this.
So my main problem is that i need to allow users to send an maximum 10mb file(doc / pdf). But if someone uploads a file bigger then 2 mb it fails to send the email, but the file is uploaded on server in wpcf7_uploads.
This is my setup
[file file-907 limit:10mb filetypes:doc|docx|pdf]
In file attachment
[file-907]
I also set up htacces to this
<IfModule mod_php5.c>
php_value post_max_size 200M
php_value upload_max_filesize 200M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200
</IfModule>
And now i am out of ideas and in need of help.
Add this deatil php.ini file:
post_max_size = 25M
default_mimetype = "text/html"
default_charset = "UTF-8"
file_uploads = On
upload_max_filesize = 25M
allow_url_fopen = On
user_agent="PHP"
default_socket_timeout = 60`

How could I increase my maximum file upload size in wordpress?

I am currently using the .htacces method to achive this
Here is what I am using so far
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
But each time I am getting error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
The better way is to change its settings through php.ini file. Find/change following options:
upload_max_filesize = 100M
post_max_size = 100M
Save this code in any php file and update it in the plugins directory and activate that plugin:
ini_set('upload_max_size','256M');
ini_set('post_max_size','256M');
ini_set('max_Execution_time','600');
You can put these lines before or after any other script in you .htaccess file. Save it and upload. That's it! Hope this helps!
#Change upload limits
php_value memory_limit 34M
php_value post_max_size 33M
php_value upload_max_filesize 32M
php_value max_execution_time 600
#Change upload limits end
In your php.ini file insert the following lines of code into it if it is not there and increase upload_max_filesize according to your requirements:
memory_limit = 100M
upload_max_filesize = 200M
post_max_size = 100M
file_uploads = On
Ok great, I just got it!!
Adding the followwing code in "wp-admin" folder does the trick
memory_limit = 100M
upload_max_filesize = 200M
post_max_size = 100M
As a summary of the above:
I add the following code in the .htaccess file in the directory wp-admin:
php_value memory_limit 34M
php_value post_max_size 33M
php_value upload_max_filesize 32M
php_value max_execution_time 600
and it worked.

Increasing the maximum post size

There is a lot of data being submitted no file uploads and the $_SERVER['CONTENT_LENGTH'] is being exceeded. Can this be increased?
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.
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.
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
You can do this with .htaccess:
php_value upload_max_filesize 20M
php_value post_max_size 20M
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.
You can increase that in php.ini
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
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.
You can specify both max post size and max file size limit in php.ini
post_max_size = 64M
upload_max_filesize = 64M
Try
LimitRequestBody 1024000000
php.ini
Change setting max_input_vars from default 1000 to 10000 for enought json post data.
It worked for me.
max_input_vars=10000
Only add the below 3 lines in .htaccess file, which is in your root folder of the project.
php_value memory_limit 500M
php_value post_max_size 500M
php_value upload_max_filesize 500M
It will completely assist you in resolving your problem.

Categories