-1

I just created a Laravel project in my windows with this command :

composer create-project --prefer-dist laravel/laravel test-windows "8.*"

But I got some errors about requirements missing during the installation of dependencies :

  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:\Program Files\PHP\v7.4\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

So I tried :

composer install --ignore-platform-reqs

So all dependencies are now installed successfully but in the end, I have another problem :

82 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

And now I can't start the project or do anything else. I'm stuck, I found a lot of things for Laravel 6 or 7 but I'm currently using Laravel 8.

Anyone can help me ?

My environment :

  • OS: Windows 10
  • Composer: version 2.0.8
  • PHP: version 7.4.1
  • Laravel (in composer.json): version ^8.65

EDIT: @apokryfos advice me to install ext-fileinfo in my php.ini. So I tried to find a way to do this, but when I'm trying to edit the php.ini file and save it, I got an error by Windows "You don't have the autorisation to do this". I'll try to reinstall PHP because I have PHP v7.4 and it's normally installed by default starting with PHP 5.3.0. So I think my PHP has a problem in local in my computer.

EDIT 2: I tried to reinstall PHP v7.4 but it doesn't change anything.

Jérôme
  • 978
  • 1
  • 9
  • 22
  • 2
    When you installed the composer dependencies and ignored platform requirements you basically installed libraries that probably won't work. The error is rather clear it says ext-fileinfo is missing from your system so you need to enable it on all php.ini configurations you intend to use – apokryfos Nov 09 '21 at 21:01
  • 1
    The problem I found some topics about enabling extension=php_fileinfo.dll in my php.ini but I can't find it's not commented, it's missing. And I don't know how to install extension=php_fileinfo.dll in windows 10.. – Jérôme Nov 09 '21 at 22:43
  • Try just adding the line `extension=php_fileinfo.dll` in the php.ini , if you still get errors that it can't be loaded then maybe you should reinstall php since it should usually be included in your php installation – apokryfos Nov 10 '21 at 05:58
  • 1
    I already tried it but I can't edit the file because I don't have the autorisation despite I'm admin. So I will try to reinstall PHP. I'll tell you. – Jérôme Nov 10 '21 at 06:25
  • Does this answer your question? [requires ext-fileinfo. How do I add that into my composer.json file?](https://stackoverflow.com/questions/23771117/requires-ext-fileinfo-how-do-i-add-that-into-my-composer-json-file) – Nico Haase Nov 10 '21 at 07:32
  • @NicoHaase thanks for your link but K already saw it and I can't fix my problem because I don't find the line in my php.ini so I can't uncomment it :( Anyway I tried to add this line but I don't have the autorisation like I said, so I'll try to reinstall PHP because I have PHP v7.4 and it's installed by default starting with PHP 5.3.0. So I think my PHP has a problem in local in my computer. – Jérôme Nov 10 '21 at 08:26
  • "I don't have the autorisation" - what does that mean? What keeps you from adding this line to the configuration when it's not there? Also, please add **all** clarification to your question by editing it – Nico Haase Nov 10 '21 at 08:27
  • It means when I tried to add the line (so edit the file) and save it, I got an error by Windows "You don't have the autorisation to do this". I'll clarify all to my question by editing it. Thanks. – Jérôme Nov 10 '21 at 08:29
  • @NicoHaase I clarified it, thanks. I'll let you know if I fix the problem by reinstalling PHP. – Jérôme Nov 10 '21 at 08:35
  • If you cannot save the file, why not open the file editor with admin permissions? – Nico Haase Nov 10 '21 at 08:38
  • I tried but I don't find how to do this because the choice is not available when I right click. I also tried to use `runas nano` but I have the same problem about autorisation.. – Jérôme Nov 10 '21 at 09:06

1 Answers1

0

I found how to edit my php.ini in my Windows as administrator, following this link :

  1. Press the Windows logo (bottom left)
  2. Type Notepad in the search field
  3. Click right on the Notepad and select Run as administrator
  4. From Notepad, click on File > Open and paste C:\Program Files\PHP\v7.4\php.ini
  5. I added the line extension=php_fileinfo.dll
  6. Save

Now, all works fine and I can use composer install

Jérôme
  • 978
  • 1
  • 9
  • 22