LoginSignup
9
5

More than 5 years have passed since last update.

laravel new コマンドでプロジェクト作成時にエラー発生でPHP.iniファイルを変更

Posted at

PHPのLaravelでプロジェクト作成コマンド「laravel new」実行したら、エラー発生し、PHP.iniファイルを修正して対応した時のメモ

laravel new laravelapp をコマンドプロンプトで実行

下記のエラーが発生した!

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for league/flysystem 1.0.49 -> satisfiable by league/flysystem[1.0.49].
- league/flysystem 1.0.49 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
Problem 2
- league/flysystem 1.0.49 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- laravel/framework v5.7.16 requires league/flysystem ^1.0.8 -> satisfiable by league/flysystem[1.0.49].
- Installation request for laravel/framework v5.7.16 -> satisfiable by laravel/framework[v5.7.16].

To enable extensions, verify that they are enabled in your .ini files:
- C:\MAMP\bin\php\php7.2.1\php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Problem 1 の原因は、「要求されたPHP拡張モジュールのfileinfoがシステムに存在しません。」というエラーの様子

「C:\MAMP\bin\php\php7.2.1\ext\php.ini」ファイルを変更
「php.ini」ファイルの「;extension=fileinfo」の先頭のセミコロンを削除「extension=fileinfo」

PHP_INI.JPG

実際の実行ファイルは「C:\MAMP\bin\php\php7.2.1\ext」フォルダの中のphp_fileinfo.dllである。

phpはインストールした段階で拡張機能もインストールされており、php.iniファイルのコメントを解除することで拡張機能が使用可能となることが分かった。

中途半端になっている「laravelapp」フォルダを削除し、laravel new laravelapp コマンドを実行

→数分ほど時間がかかり、無事に成功した。

9
5
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
9
5