0
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 3 years have passed since last update.

EC2サーバーでlaravelのサービスを動かしていたらzip化の処理でエラーが発生した

Posted at

目的

  • 記事の主題のエラーが出たので解決方法をメモ的にまとめる

エラー部分

  1. 下記のソースの最後の部分でエラーが発生した。

    $zip = new ZipArchive();
    $zip->open('zipファイルのパス', ZipArchive::CREATE | ZipArchive::OVERWRITE);
    $zip->addFromString('ファイル名', 'ファイルパス');
    

エラー内容

  1. ZipArchive()を使用したzip化処理で「Invalid or uninitialized Zip object」のエラーが発生した。

解決までの経緯

  1. 原因はzipファイルがopenされたディレクトリの権限がなかった。
  2. zipファイルがopenされるディレクトリの権限を770に設定したところ問題は解決した。
0
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
0
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?