I have Ubuntu 18.04.1 LTS which comes with ImageMagick 6.9.7 by default and I wanted ImageMagick to process jp2 images so I installed libopenjp2-7-dev and also installed imagemagick7 from source like this:
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-7.0.10-22
./configure
make
sudo make install
sudo ldconfig /usr/local/lib
magick -version shows the right one:
Version: ImageMagick 7.0.10-22 Q16 x86_64 2020-07-02 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): jng jp2 jpeg png xml zlib
But in phpinfo() it shows:
imagick module version 3.4.4
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Imagick using ImageMagick library version ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
I even tried to remove the ImageMagick 6.9.7 and the PHP-Imagick extension, I thought that by reinstalling the extension with only one version available, it will somehow point at that but the extension couldn't be installed without ImageMagick6. I'm out of ideas on how to make PHP use the ImageMagick 7.