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

后端 未结 4 1397
北海茫月
北海茫月 2020-12-09 09:37

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

\"enter

相关标签:
4条回答
  • 2020-12-09 09:43

    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.

    0 讨论(0)
  • 2020-12-09 09:47

    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.

    0 讨论(0)
  • 2020-12-09 10:04

    For people with WAMP

    Left click the tray icon -> PHP -> PHP extension -> php_fileinfo

    It will restart your server and you're done.

    If that does not work, try editing the php.ini inside: C:\wamp\bin\php\php5.4.12 (last part depends on your version of php)

    Look for the line: ;extension=php_fileinfo.dll and remove the ;

    Save and restart WAMP services.

    0 讨论(0)
  • 2020-12-09 10:07

    If anyone else is on DreamHost (like me) or finds that the php.ini edits don't do what you want, you can try another route.

    Here's the DreamHost Wiki page on PHP.ini, but I'll list the steps below as well.

    Step 1: Create a PHP configuration file (phprc)

    1. In your user's home folder (/home/your_user_name), create a new folder called .php (notice the leading period)
    2. Inside this new folder, create another folder based on the version of PHP that you're using. You can find this (and change it) on the hosting panel (DreamHost's is at panel.dreamhost.com under Domains > Manage Domains). So if you're using PHP version 5.6, create a folder called 5.6.
    3. Inside this new folder, create a new file called phprc (no extension). If there's already a phprc file in this folder, you can back it up by changing the filename to phprc.old.

    Step 2: Edit phprc to include the extension

    1. Open your new phprc file.
    2. Add this line to the end: extension = fileinfo.so
    3. Save the file

    Step 3: Restart PHP and/or your web server

    Via Panel

    If you have shared hosting, or you aren't comfortable with SSH or the command line, you can force DreamHost to pick up your new phprc settings.

    1. Navigate back to your Panel, and go to Domains > Manage Domains.
    2. Click Edit next to the domain you're working on.
    3. Don't make any changes here. Simply scroll down and click Change Settings at the bottom of the first section.
    4. Within about 10 minutes, DreamHost will pull in your changes.
    5. If you don't see updates after 10 minutes (be patient!), contact support for help.
    Via SSH

    If you're comfortable with the command line (and you're not using shared hosting), SSH into your server and run the following commands:

    For Apache web servers
    sudo /etc/init.d/httpd2 restart
    
    For Nginx web servers
    sudo /etc/init.d/nginx stop
    pkill -9 php
    sudo /etc/init.d/nginx start
    

    Your specific commands may be slightly different, but if you're comfortable with CLI then you probably know your specific command.

    0 讨论(0)
提交回复
热议问题