vic*_*ico 5 php windows iis wordpress file-upload
我有一个运行PHP 7.1的Windows 2012 R2 Server,在IIS7上托管了一个Wordpress
wordpress媒体库的默认上载大小为2MB,我可以将其更改php.ini为512MB。但是,当上传大文件时,尤其是超过70 MB的文件,上传开始,然后暂停并挂在中间。服务器超时后,我收到wordpress HTTP错误。
net::ERR_CONNECTION_RESET在检查控制台上。
此超时发生在上传开始后的10到20秒之间,并且在不同的生产环境中会立即发生。
我已经做了很多搜索,并在Windows安装程序上使用新的wordpress创建了一个新环境,但是在Windows 2007 SP2安装程序上遇到了同样的问题。
Inside wp-config.php
@ini_set( 'upload_max_size' , '512M' );
@ini_set( 'post_max_size', '512M' );
@ini_set( 'memory_limit', '1024M' );
@ini_set( 'max_execution_time', '300' );
Run Code Online (Sandbox Code Playgroud)
inside web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="1048576" requestLengthDiskThreshold="1048576"/>
<identity impersonate="true"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824"></requestLimits>
</requestFiltering>
</security>
<rewrite>
<rules/>
</rewrite>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
inside php.ini
upload_max_filesize = 512M
post_max_size = 512M
memory_limit = 1024M
max_execution_time = 300
Run Code Online (Sandbox Code Playgroud)
不知道还有什么可以解决的。该错误显示在具有基本主题的基本wordpress安装上。
这是因为在为连接启用 PHP 之前,IIS Web 服务器有自己的上传/内容大小限制,因此设置 PHP 内容可以控制 PHP,但不能控制 IIS。
您可以在http://ajaxuploader.com/large-file-upload-iis-asp-net.htm阅读有关它以及如何修复的信息
它的主要内容是添加
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="536870912" />
</requestFiltering>
</security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
到站点的公共目录或根目录中的 web.config。其中maxAllowedContentLength属性是你的'post_max_size'在512MB的情况下的字节数(512*1024*1024) = 536870912
| 归档时间: |
|
| 查看次数: |
580 次 |
| 最近记录: |