Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requires ext-fileinfo. How do I add that into my composer.json file?

Tags:

I am trying to install intervention/image. After running the composer update, I get:

enter image description here

This is my composer file:

{     "name": "laravel/laravel",     "description": "The Laravel Framework.",     "keywords": ["framework", "laravel"],     "license": "MIT",     "require": {         "laravel/framework": "4.1.*",         "intervention/image": "2.*"     },     "autoload": {         "classmap": [             "app/commands",             "app/controllers",             "app/models",             "app/database/migrations",             "app/database/seeds",             "app/tests/TestCase.php"         ]     },     "scripts": {         "post-install-cmd": [             "php artisan clear-compiled",             "php artisan optimize"         ],         "post-update-cmd": [             "php artisan clear-compiled",             "php artisan optimize"         ],         "post-create-project-cmd": [             "php artisan key:generate"         ]     },     "config": {         "preferred-install": "dist"     },     "minimum-stability": "stable" } 
like image 265
Monica Avatar asked May 20 '14 22:05

Monica


People also ask

How do I install or enable PHP's FileInfo extension?

Windows users must include bundled php_fileinfo. dll DLL file in php. ini to enable this extension. The libmagic library can be bundled with PHP but include PHP specific changes.

How do I enable FileInfo extension in xampp?

On xampp you basically need to edit the php. ini file and uncomment the line which enables the extension. You should find the php. ini file in the xampp folder.


2 Answers

Nothing to do with your composer.json.

You need to install & enable FileInfo PHP extension, which is installed by default starting with PHP 5.3.0. Versions prior to 5.3+ may use the discontinued PECL extension.

To enable FileInfo extension, you need to edit your php.ini and change a single line.

  1. Locate the line:

    ;extension=php_fileinfo.dll 
  2. Remove the starting comment:

    extension=php_fileinfo.dll 

To find out where your php.ini is located, you can run the following command from a terminal:

$ php --ini 

and search for "Loaded Configuration File".

Please note that the PHP CLI can load a different php.ini file than the web, so don't rely on the path provided in phpinfo(). Run the command specified above in a terminal to find out the file loaded by PHP CLI.

like image 80
Alexandru Guzinschi Avatar answered Sep 20 '22 21:09

Alexandru Guzinschi


We dont need to do anything in composer.json

Windows

Enable fileinfo extension in php.ini

extension= php_fileinfo.dll 

In Linux

1) Download and untar the package

wget http://pecl.php.net/get/Fileinfo-1.0.4.tgz

tar -zxf Fileinfo-1.0.4.tgz

cd Fileinfo-1.0.4

2) Generate the extension for compiling

phpize

3) Configure the module

./configure

4) generate the install files and install it

make

make install

5) Now the extension will be available under the /usr/lib64/php/modules directory. You now need to add the extension somewhere in the php configuration file. Edit /etc/php.ini and add the following: extension=fileinfo.so 6) Save the file and restart the webserver

service httpd restart

To verify fileinfo module is enabled properly, execute:

php -i | grep fileinfo

fileinfo support => enabled

Alternate method

Just an FYI, the module can also be installed using the PECL command i.e.

pecl install fileinfo

Once done, just follow steps 5 and 6 mentioned above to enable it. That’s it.

like image 35
sumit Avatar answered Sep 19 '22 21:09

sumit