PHP - 大 POST 请求服务器错误

PHP - Large POST Request Server Error

对于我的网络服务器,我在 Windows Server 2012 上使用 IIS8,带有 ASP.NET、PHP7+ 和 FastCGI。

我的问题:当我尝试提交带有值字符串的公式(HTML 到 PHP)时,在这种情况下超过 20.000 个字符,服务器 returns 500服务器错误 OR 它根本无法识别 post 请求。

我的HTML/PHP代码:

<?php if(isset($_POST['submit'])) { echo "Got it!"; } ?> 

<form action="" method="post">
<input type="text" value="String with 20000+ characters" name="value">
<input type="submit" name="submit">
</form>

点击提交,出现服务器错误。在 post 请求中,这些行被插入到 PHP 错误日志文件中:

[] PHP Warning:  Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0
[] PHP Warning:  Unknown: POST data can't be buffered; all data discarded in Unknown on line 0

我还编辑了所有可能与此相关的配置选项

php.ini

post_max_size = 1024M
memory_limit = 512M
upload_max_filesize = 1024M

web.config 在我的服务器上

<system.web><httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
</system.web>

    <security>
<requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>

感谢您的支持。

在终端类型中:

chmod -R 777 /your/upload/folder

你可以通过执行这段代码知道你的php上传文件的文件夹:

$tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
die($tmp_dir);

在我的例子中,我得到 /var/... 所以当我设置 777 权限时,我没有收到任何错误。

就我而言,硬盘驱动器已满。所以没有 space 甚至写入临时数据。删除一些文件后,一切都再次 POST。