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?

【備忘録】phpspreadsheet ファイル形式またはファイル拡張子が正しくありません。

Last updated at Posted at 2025-02-03

個人用備忘録

すごく久しぶりにPHPを触る事になったものの、Laravel一強になった現状、完全に浦島太郎である。

どうにかPhpSpreadsheetをcomposerからインストールしたものの
「ファイル形式またはファイル拡張子が正しくありません。」と出てExcelが開けない。
libzipを入れるらしいけどyumコマンドの記事しか見つけられなかった。検索のやり方が下手。


【環境】
 Windows
 PHP:8.3
 開発環境:Laragon


  1. 以下urlからDownloads列のDLLをクリック、対応するPHPバージョン・ビット数のリンクをクリックしてzipファイルを入手
    https://pecl.php.net/package/zip
     
  2. zipを開いて[php_zip.dll]を使用したいPHPバージョンの[ext]フォルダに入れる。

LaragonをWindows10,11などにデフォルトインストールしている場合、こんな感じになると思う
C:\laragon\bin\php[phpバージョン]\ext\php_zip.dll

 
3. 一階層上がってPHPフォルダの[PHP.ini]を編集、extensionを有効にする。

php.ini
;extension=zip
extension=zip

php_zip.dllがなぜか入ってたので合わないバージョンを過去に突っ込んだだけだtかもしれない。

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?