LoginSignup
2
2

More than 5 years have passed since last update.

Azure AppServiceのPHPで大きなファイルをアップロードできるようにする

Posted at

概要

Azure AppServiceでPHP Empty WebAppをつかってWebアプリをデプロイした場合に、ファイルのアップロードサイズに制限がある。
以下ではその回避方法について解説するが、こちらを参考にしている。
Uploading Large Files to Azure Web Apps

作業

IISの設定ファイルをwwwrootに置く

以下の内容のweb.configファイルを作成する。
<valueInBytes>は最大アップロードサイズをbyteで入力する。
(50MB = 50*1024*1024 = 52428800)

web.config
<configuration>
   <system.webServer>
      <security>
         <requestFiltering>
            <requestLimits maxAllowedContentLength="<valueInBytes>"/>
         </requestFiltering>
      </security>
   </system.webServer>
</configuration>

このファイルをwwwrootに置く。
初期状態では、D:\home\site\wwwroot\に置くことになる。

PHP.iniの設定をオーバーライドする

以下の内容のphp_overrides.iniを作成する。
最大アップロードサイズを50MBにする場合は以下のように記述する。

php_overrides.ini
[php]
post_max_size=50M
upload_max_filesize=50M

このファイルをD:\home\site\ini\に置くことになる。

WebAppを再起動する

設定が反映される。

参考

ファイルのアップロードや編集はKuduが便利です。
使い方はこちらを参考にするとよいでしょう。
Kuduを使ってWebサイトのデータをアップロードしてみました。

以上。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2