0
2

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.

【Laravel】Laravel入門備忘録 php artisan serve実行時エラーについて

Posted at

記事の目的

書籍「PHPフレームワーク Laravel入門 第2版」を学習する中で、おそらくまた同じ問題に引っ掛かるであろう部分をまとめた備忘録です。

困ったこと

アプリケーション作成後(laravel new 実行後)、php artisan serve 実行した際に下記エラーが発生。

PHP Warning:  require(C:\1_Project\laravelapp/vendor/autoload.php): Failed to open stream: No such file or directory in C:\1_Project\laravelapp\artisan on line 18
PHP Fatal error:  Uncaught Error: Failed opening required

環境

OS:windows10
Laravel:8.40

対処法

php.iniファイルを修正。コメントアウトされている部分を解除します。

【変更前】

;extension=fileinfo

【変更後】

extension=fileinfo

余談

php.iniを修正する前にcomposer install を実行してみると下記エラーが発生する。

No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v8.40.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
    - league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - Root composer.json requires laravel/framework ^8.40 -> satisfiable by laravel/framework[v8.40.0, ..., 8.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - C:\Program Files (x86)\php-8.0.0-Win32-vs16-x64\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

この辺の情報が大切。
PHPの拡張モジュールを有効化してほしい、的な意味です。

- league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
To enable extensions, verify that they are enabled in your .ini files:
    - C:\Program Files (x86)\php-8.0.0-Win32-vs16-x64\php.ini
0
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?