Laravel:サーバー起動エラー

"php artisan serve" でエラーとなった。


エラー内容

C:\projects\ressys>php artisan serve
PHP Warning:  require(C:\projects\ressys/vendor/autoload.php): Failed to open stream: No such file or directory in C:\projects\ressys\artisan on line 18

Warning: require(C:\projects\ressys/vendor/autoload.php): Failed to open stream: No such file or 
directory in C:\projects\ressys\artisan on line 18
PHP Fatal error:  Uncaught Error: Failed opening required 'C:\projects\ressys/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\projects\ressys\artisan:18
Stack trace:
#0 {main}
  thrown in C:\projects\ressys\artisan on line 18

Fatal error: Uncaught Error: Failed opening required 'C:\projects\ressys/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\projects\ressys\artisan:18
Stack trace:
#0 {main}
  thrown in C:\projects\ressys\artisan on line 18    
  

対応 1

"composer update" を実行すれば治る、ということでやってみたが…
C:\projects\ressys>composer update
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.65.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.65 -> satisfiable by laravel/framework[v8.65.0, ..., 8.x-dev].

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

対応 2

php.iniのextensionの追加で治る?
以下行をextensionのあたりに適当に追加
extension=php_fileinfo.dll    
  
再度 "composer update" を実行 → 成功
"php artisan serve" を実行 → 成功
ブラウザで http://localhost:8000 を表示 → ブラウザでエラーが表示された
Illuminate\Encryption\MissingAppKeyException
No application encryption key has been specified.    
  

対応 3

プロジェクトフォルダで "php artisan key:generate" コマンドを実行
C:\projects\ressys>php artisan key:generate
Application key set successfully. 
  
http://localhost:8000 をブラウザで表示 → 成功


PHP, Laravel

0 件のコメント:

その他の記事