x_Badass
x_Badass

Reputation: 11

Error while creating new Laravel Project - fixing php.ini

First I installed PHP from PHP's official site ( Windows Download ): PHP 8.1 (8.1.8)

Then I installed composer from the official site and its version is Composer version 2.3.10 2022-07-13.

Then I ran composer global require laravel/installer So after this running laravel in the terminal gives me: Laravel Installer 4.2.12

Now finally, I try to do: composer create-project laravel/laravel freeCodeGram and I am getting this:

Creating a "laravel/laravel" project at "./freeCodeGram"
Installing laravel/laravel (v9.2.1)
  - Installing laravel/laravel (v9.2.1): Extracting archive
Created project in C:\Users\john\NewOneDrive\OneDrive\Desktop\freeCodeGram
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v9.19.0, ..., 9.x-dev] require league/flysystem ^3.0.16 -> satisfiable by league/flysystem[3.0.16, ..., 3.x-dev].
    - league/flysystem[3.0.16, ..., 3.x-dev] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.11.0].
    - league/mime-type-detection[1.0.0, ..., 1.3.0] require php ^7.2 -> your php version (8.1.8) does not satisfy that requirement.
    - league/mime-type-detection[1.4.0, ..., 1.11.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - Root composer.json requires laravel/framework ^9.19 -> satisfiable by laravel/framework[v9.19.0, v9.20.0, 9.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - C:\Program Files\php-8.1.8\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.

Now, How do I fix it?

I looked around and people are saying: 'We need to uncomment the extension extension = fileinfo in the php.ini file from the source folder'

But there is no php.ini filename in the related directory, there is only: php -> configuration settings php.ini-production php.ini-development

and I opened all 3 of them and there is no match for extension = fileinfo so how do I fix this?

Upvotes: 0

Views: 2247

Answers (4)

Raihan
Raihan

Reputation: 1

I also have the same problem, if I solve it this is how. To solve this problem, you can go to the PHP folder, this condition depends on where you save it, if I'm in C:\Program Files. After that, look for a file with the name php.ini. Then open it using a text editor and look for extension=fileinfo, uncomment this which was originally ;extension=fileinfo, change it to something like this extension=fileinfo. I hope this can help with the same problem.

Upvotes: 0

Ishaya Mapida
Ishaya Mapida

Reputation: 1

Go to xampp > php folde, you will find a file named php.ini(the file extension maybe hiding), but if you check the file TYPE you will see that it is a configuration settings file. Open it in your favorite text editor and uncomment the extension=zip then save it. That's all. Enjoy.

Upvotes: 0

Yalab
Yalab

Reputation: 1

I had the same problem but even after uncommenting extension=fileinfo it kept showing the same error, turns out that I uncommented it from php.ini that was in the config of xampp and not in the main configuration folder found in the C drive. Uncommenting the same line from both files solved the problem.

Upvotes: 0

x_Badass
x_Badass

Reputation: 11

Found the answer, we have to look into the configuration folder for the extension fileinfo

Upvotes: 1

Related Questions