Reputation: 39
I try to install the phpspreadysheet but these error occurs
Installation failed, deleting ./composer.json.
[RuntimeException]
No composer.json present in the current directory (./composer.json), this may
be the cause of the following exception.
[InvalidArgumentException]
Package phpoffice/phpspreadsheet has requirements incompatible with your PHP v
ersion, PHP extensions and Composer version:
- phpoffice/phpspreadsheet 1.22.0 requires ext-fileinfo * but it is not pres
ent.
- phpoffice/phpspreadsheet 1.22.0 requires ext-gd * but it is not present.
Does anyone know how to fix this? I am stuck with these errors for two days and could not find the solution. Thank you
Upvotes: 3
Views: 35349
Reputation: 91
To solve this, you have to do the following:
c:/xampp/php/php.ini
fileinfo
and gd
;extension=fileinfo
;extension=gd
extension=fileinfo
extension=gd
Upvotes: 5
Reputation: 4661
This problem will fix it by doing this.
composer install --ignore-platform-reqs
Upvotes: 0
Reputation: 11
First, you need to understand what version of PHP the composer is running on; you can find out by entering the command into the console:
php -v
After that, open the folder of this version of PHP and look for the php.ini file, and uncomment the lines that are asked in the error, these are:
extension=fileinfo
extension=gd
extension=zip
And voila, everything works! In a new way, we run the composer command to load the library.
Upvotes: 1
Reputation: 187
Running these three commands worked for me, in my case:
composer require "ext-gd:*" --ignore-platform-reqs
composer require "ext-fileinfo:*" --ignore-platform-reqs
composer require phpoffice/phpspreadsheet --ignore-platform-reqs
Upvotes: 7
Reputation: 11
I have been facing the same error First, check which php.ini file you are working with with command: PHP -ini That's happened to me because I have both Xampp and Wamp on my machine and even fix extensions won't make it work
and to add a gd extension do these steps:
Open Wamp on the taskbar and then open the PHP version you are using then edit extensions search for fileinfo and gd if your see ;extension=fileinfo ;extension=gd Remove the semicolon so it will be like this: extension=fileinfo extension=gd Close the file and re-run the Wampp
Upvotes: 1
Reputation: 67
Open your project in visual studio and click ctr+shift+` to open terminal or open cmd and to your project directory
and paste below code
composer require phpoffice/phpspreadsheet --ignore-platform-req=ext-gd
Above syntax worked form me.
Upvotes: 0
Reputation: 162
open php.ini, search and uncomment following
Upvotes: 13