php 增加最大帖子大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6135427/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Increasing the maximum post size
提问by Daniel
There is a lot of data being submitted no file uploads and the $_SERVER['CONTENT_LENGTH']
is being exceeded. Can this be increased?
有很多数据被提交没有文件上传并且$_SERVER['CONTENT_LENGTH']
正在被超过。这个可以增加吗?
回答by John Green
There are 2 different places you can set it:
您可以在 2 个不同的地方设置它:
php.ini
配置文件
post_max_size=20M
upload_max_filesize=20M
.htaccess / httpd.conf / virtualhost include
.htaccess / httpd.conf / virtualhost 包括
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.
.htaccess 不需要重启服务器,但 php.ini 和其他 apache conf 文件需要。
回答by RandomWhiteTrash
I had a situation when variables went missing from POST and all of the above answers didn't help. It turned out that
我遇到过变量从 POST 中丢失的情况,并且上述所有答案都没有帮助。事实证明
max_input_vars=1000
was set by default and POST in question had more than that. This may be a problem.
是默认设置的,有问题的 POST 不止于此。这可能是一个问题。
回答by Muhammad Zeeshan
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
回答by RJD22
You can do this with .htaccess:
你可以用 .htaccess 做到这一点:
php_value upload_max_filesize 20M
php_value post_max_size 20M
回答by Ivan Lazarevic
You can increase that in php.ini
您可以在 php.ini 中增加它
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
回答by Neel Thakkar
We can Increasing the maximum limit using .htaccess
file.
我们可以使用.htaccess
文件增加最大限制。
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.
如果有时其他方式不起作用,这种方式工作完美。
回答by NathanD
You can specify both max post size and max file size limit in php.ini
您可以在 php.ini 中指定最大帖子大小和最大文件大小限制
post_max_size = 64M
upload_max_filesize = 64M
回答by ahmed
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.
希望这可以帮助。
回答by pavel
Try
尝试
LimitRequestBody 1024000000