PHP-大型POST请求服务器错误


PHP - Large POST Request Server Error

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

我的问题是:当我试图提交一个带有值字符串的公式(HTML到PHP)时,在大于20.000个字符的情况下,服务器会返回一个500服务器错误它根本无法识别发布请求。

我的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权限时,我不会出错。

在我的情况下,硬盘驱动器已满。因此,甚至没有空间写入临时数据。删除了一些文件后,一切都重新进行了POST。