Once installed, create a configuration file for the extension and restart PHP by running the following commands as root: sudo bash -c "echo extension=imagick.so > /etc/php7.4-sp/conf.d/imagick.ini"įIf you are using other PHP version, just replace all 7.4 with yours. Just press Enter do not type a prefix (that is, allow autodetect). When prompted with: Please provide the prefix of Imagemagick installation :
So, it’s up to your hosting to get these server level things set up properly.
However, I doubt that a commercial host would be running Fedora.
#Imagemagick php 7.4 install
Sudo apt-get -y install libmagickwand-dev I have ImageMagick running happily with PHP 7.4 on Fedora 32 via the php-pecl system: php-pecl-imagick- for the current version of ImageMagick, ImageMagick 6.9.10-86 Q16 x8664. To install this extension, run the following commands as your server’s root user (I’m using Ubuntu server): sudo apt-get -y install gcc make autoconf libc-dev pkg-config The ImageMagick extension, called Imagick when referring to the PHP extension, is a native PHP extension to create and modify images using the ImageMagick API. Imagick using ImageMagick library version => ImageMagick 6.9.Yesterday, I got a warning on my blog dashboard, told me that one recommended plugins has not been installed/configured. Imagick compiled with ImageMagick version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 Imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel This gives the following info: $ docker-compose exec php php -i (The same performance issue was present when installing the PHP extension imagick and libmagickwand-dev manually, without mlocati/php-extension-installer.) The new system uses Docker ( sudo yum install docker on 圆4 Amazon Linux 2) with the following Dockerfile for the PHP container: FROM php:7.4-fpmĬOPY -from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ Imagick using ImageMagick library version => ImageMagick 6.7.8-9 Q16 Imagick compiled with ImageMagick version => ImageMagick 6.7.8-9 Q16 Imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator Īnd it shows the following info: $ php -i On the old system (using 圆4 Amazon Linux AMI version 1), PHP was set up as follows: sudo yum install php55-pecl-imagick. However, here the CPU usage only went up to 150–180%, according to top and docker stats. The new system was unused while running the test script, so it also had plenty of CPU/memory available. While running the test script, its CPU usage went to >300% (according to top). The old system was in use while running the test script, but it had plenty of CPU/memory available. Therefore, I wouldn’t expect this resizing to be slower than before.ĭoes anyone have an idea what could cause this, and more importantly, how the performance can be improved in the new system? System usage Both systems use the same type of EC2 instances, and no explicit resource limitations are setup for the Docker container in the new system. In other words, the PHP 7.4 setup is 6 times slower than the old PHP 5.5 setup! (The times were measured from within the PHP script, so nginx/php-fpm shouldn’t have played a role.)įor other kinds of requests, the new setup if performing fine (slightly faster than the old one, as may be expected from PHP 7).
To diagnose the issue, I’ve made the following simple script, with a 5MB JPEG as input: readImage($image_name)
#Imagemagick php 7.4 how to
The performance for image resizing using ImageMagick has decreased a lot. Re: ImageMagick 6.7.4 convert Post by fmw42 T19:51:23+01:00 I am not sure I can help much other than to suggest you check your version of libtiff and upgrade if necessary to a current version. PHP Imagick by Example Imagick - covers all the methods of the Imagick class which how to modify pixel based images. I’m upgrading some system from PHP 5.5 (installed directly on AWS EC2), to PHP 7.4 in Docker (running on AWS EC2 using Docker Compose).