2

I am just picking up one legacy laravel project by using composer cli. I executed composer install but it's saying one Error spatie/pdf-to-image 1.8.2 requires ext-imagick Error. I couldn't figure it out. I guess it's because imagick extension wasn't set properly in php.ini. Anybody has ever faced on this kind of error before? Thank you in advance.

apollo
  • 175
  • 1
  • 5
  • 16
  • 1
    Does this answer your question? [ext-imagick \* -> the requested PHP extension imagick is missing from your system](https://stackoverflow.com/questions/35829419/ext-imagick-the-requested-php-extension-imagick-is-missing-from-your-system) – Tpojka May 24 '20 at 11:16
  • No, I couldn't solve the problem through the answer. – apollo May 24 '20 at 11:44
  • Do you have the imagick extension installed for your PHP installation? What is your platform? – Jimmie Lin May 25 '20 at 02:23

2 Answers2

5

You didn't have the Imagick extension installed on your machine. Also you should make sure you have uncommented out Imagick.so in php.ini. You can follow up the next steps if you are using macOS.

First, install imagemagick itself. This is needed to get the source files you’ll use later to compile the PHP extension with.

brew install pkg-config imagemagick

This will also install the needed pkg-config dependency.

Second, use pecl to get the PHP extension compiled.

pecl install imagick

It will also auto-register itself in your php.ini and should now be available

Lastly, test imagick extension would be available.

php -m | grep -i magic

This command would show imagick if it's properly set out.

Note: if you run php-fpm, make sure you restart your daemon to load the latest extension. Use brew services restart php

Martin V
  • 82
  • 5
1

Like you said, you simply do not have php extension imagick that is used in "spatie/pdf-to-image" that you are trying to use.

You can check if imagick is installed with function phpinfo();

Installation / activation depends what system you are using.

Under Ubuuntu you can install it with single command:

apt-get install php-imagick

Whatever system you are using, make sure that imagick is not already installed and just commented in php.ini

chojnicki
  • 3,148
  • 1
  • 18
  • 32