Unable to change upload_max_filesize to Azure

风流意气都作罢 提交于 2021-02-08 01:50:24

问题


I have a Laravel Azure website.

I have a .user.ini file where I have some settings like

upload_max_filesize=120M
post_max_size=121M
output_buffering=Off
max_execution_time=3000
max_input_time=3000
memory_limit=140M

But, strangely enough, only max_execution_time and memory_limit changed. I also tried ini_set() but with the same result.

Is there a solution for this?


回答1:


Basically I added in the settings PHP_INI_SCAN_DIR with the value of the folder path to the .user.ini




回答2:


As PHP applications on Azure are actually hosted on IIS, so the limit upload file size is not only controlled by PHP settings but also by IIS configurations.

By default, the maximum length of content in a request is set 30000000 in IIS which is approximately 28.6MB. You can refer to https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits#005 for more details.

And beside custom configuration of PHP, you also need to create a web.config in your root directory, whose content can be the following sample:

<configuration>

    <appSettings/>
    <connectionStrings/>
    <system.web>
        <httpRuntime maxRequestLength="1073741824" />
    </system.web>
    <system.webServer>
    <security>
      <requestFiltering>
        <!-- maxAllowedContentLength is in bytes (B)  -->
        <requestLimits maxAllowedContentLength="1073741824"/>
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>


来源:https://stackoverflow.com/questions/34594599/unable-to-change-upload-max-filesize-to-azure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!