- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在研究在 PHP 中设置默认值的最佳值是什么。我见过很多关于 max_input_time
的矛盾点。
这个回答说他认为文件上传不计入计时器: https://stackoverflow.com/a/3758522/518169
在PHP官方文档中,有一个巨大的红色警告:
max_input_time sets the maximum time, in seconds, the script is allowed to receive input; this includes file uploads. For large or multiple files, or users on slower connections, the default of 60 seconds may be exceeded
来源:http://php.net/manual/en/features.file-upload.common-pitfalls.php , 最后更新:2012 年 7 月 6 日星期五
因此,从这里看来 max_input_time
确实会影响 文件上传,并确保访问者可以上传 20 MB 的文件,即使是从慢速或移动连接,默认值60的绝对不够!
您建议将此值设置为什么? 300?
还有,max_execution_time
和max_input_time
有什么关系吗?例如 max_execution_time
需要大于 max_input_time
吗?
最佳答案
经过一些快速基准测试我认为 max_input_time
对处理连接速度较慢的用户的大量上传没有任何影响。
来自 http://us3.php.net/manual/en/info.configuration.php#ini.max-input-time
This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. It is measured from the moment of receiving all data on the server to the start of script execution.
我使用的是 PHP 5.3.8 并使用了以下 .htaccess 配置
php_value max_input_time 5
php_value max_execution_time 1
php_value upload_max_filesize "2048M"
php_value post_max_size "2048M"
我的测试脚本是:
<?php
if (!empty($_FILES)) {
echo '<pre>';
var_dump($_FILES);
echo '</pre>';
}
?>
<form enctype="multipart/form-data" method="POST">
File: <input name="userfile" type="file" />
<input type="submit" value="Upload" />
</form>
经过多次试验,我的 1.5G 文件大约需要 16-17 秒上传,4-5 秒处理,执行时间基本上为 0。
max_input_time 5
脚本完成。将其设置为 4 我们得到 PHP Fatal error: Maximum execution time of 4 seconds exceeded in Unknown on line 0, referer: http://localhost/test-upload.php
似乎 max_execution_time
也没有任何影响,因为我们在整个测试过程中都将它保持在 1。
关于PHP 文件上传是否受 max_input_time 影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11387113/
似乎 max_execution_time 是 0 但 memory_limit 是 -1。 max_input_time 是 0 还是 -1 还是两者兼而有之? 最佳答案 绝对最大值是C中long类
我可以设置如下PHP配置参数吗: 最大执行时间 = 360最大输入时间 360 这样安全高效吗? 我实际上需要我的用户使用基于 php 的内容管理系统上传大型视频。 因此,每个视频上传都需要几分钟时间
我正在研究在 PHP 中设置默认值的最佳值是什么。我见过很多关于 max_input_time 的矛盾点。 这个回答说他认为文件上传不计入计时器: https://stackoverflow.com/
我在文档中找不到这个,但确实是: max_input_time = -1 意思是没有限制? 我觉得奇怪的是 max_execution_time = 0 是永远的。 但是 -1 对 max_input
在 Ubuntu 中,我试图将 max_input_time 更改为 -1 在 php.ini 中,我看到以下部分: ; max_input_time ; Default Value: -1 (U
我正在检查我的 PHP 配置并阅读 max_execution_time 30 max_input_time 60 这些是秒还是分钟? 如果它们是几秒钟,比方说,我需要使用 php 脚本 (CMS)
我是一名优秀的程序员,十分优秀!