how to install imagemagick for php7 on ubuntu?

Just do:

sudo apt-get install php-imagick

This should install imagick for PHP 7.0.


Turns out I had to restart the fpm:

sudo service php7.0-fpm reload

Things I tried:

apt install php-imagick didn't work for me. The module was getting loaded for the PHP CLI (I checked with php -m | grep -i imagick but through my nginx webserver it didn't show up in the list of modules reported by phpinfo() at all.

I even inserted extension=imagick.so to /etc/php/7.0/fpm/php.ini manually, just to make sure.

I then tried purging the php-imagick package and installing from cpan:

sudo apt install libmagickwand-dev imagemagick php-dev
sudo pecl install imagick

And still, no cigar. It would work through the cli but not via nginx.


Installed these packages:

sudo apt install libmagickwand-dev imagemagick php-dev
sudo pecl install imagick

Now replace:

sudo service php7.0-fpm reload

With:

sudo service apache2 restart

Works Great