1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Laravel】Herokuでファイルアップロードのサイズ上限値を変更する(Apache)

1
Posted at

事象確認

post_max_sizeはデフォルトで8Mが設定されているようです。


$ heroku logs -t
2020-03-20T14:58:54.361490+00:00 app[web.1]: [20-Mar-2020 14:58:54 UTC] PHP Warning:  POST Content-Length of 9423684 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

手順

公式ドキュメントによると、.user.iniファイルを作成してあげれば良いようです。

Customizing Web Server and Runtime Settings for PHP
https://devcenter.heroku.com/articles/custom-php-settings#php-runtime-settings

publicディレクトリに.user.iniファイルを作成し、POSTの最大サイズとファイルの最大サイズを設定します。
git pushして変わっていることを確認しましょう。

public/.user.ini
post_max_size = 20M
upload_max_filesize = 5M
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?