php – when I use composer update or update new extensions, get error says verify that they are enabled in your .ini files-ThrowExceptions

Exception or error:

The error message is like this:

To enable extensions, verify that they are enabled in your .ini
files: — – -/usr/local/etc/php/7.2/php.ini
– /usr/local/etc/php/7.2/conf.d/ext-opcache.ini
– /usr/local/etc/php/7.2/conf.d/xdebug.ini

error screenshot

I don’t know how to enable this file. But when I go into that path, it exists. Can everyone help me solve that? Thanks a lot!

How to solve:

You need to install imagick to resolve this issue:

As per the Laravel Medialibrary requirements

The Medialibrary package requires PHP 5.5.9+ and Laravel 5.1.0+. To
create derived images GD needs to be installed on your server. If you
want to create PDF thumbnails Imagick is also required.

GD and Imagick can be installed using apt-get on Ubuntu and Debian:

$ apt-get install php-gd imagemagick php-imagick

Or with yum on CentOS:

$ yum install php70u-gd ImageMagick ImageMagick-devel

Note: Root access to your server is probably required.

OR

To resolve this add below lines in your composer.json:

{
    "require": {
       "spatie/laravel-medialibrary": "^7.0.0" // add this line
    },
   "provide": { // add this
       "ext-imagick": "*" //add this
   },  // add this
    "require-dev": {

    }
}

and run your command again

References:

https://docs.spatie.be/laravel-medialibrary/v3/requirements/#

https://github.com/spatie/laravel-medialibrary/issues/1480

https://github.com/spatie/laravel-medialibrary/issues/1553

Leave a Reply

Your email address will not be published. Required fields are marked *