Ali Cloud Linux3 : Installing ImageMagick for PHP 7.4

Step 1: If not already installed, install the php-devel and gcc packages.
$ sudo yum install php-devel gcc

To check if the packages are installed, use the following commands. If either command returns an empty result (or both do), you’ll need to install that package (or both).

$ sudo yum list installed | grep php-devel
$ which gcc

Step 2: Install the ImageMagick packages
$ sudo yum install ImageMagick ImageMagick-devel ImageMagick-perl

Step 3: Compile ImageMagick packages.
$ sudo pecl install imagick
if pecl not installed, run below command to get pecl.
$ sudo yum install php-pear

Step 4: Change the permissions on the compiled module.
$ sudo chmod 755 /usr/lib64/php/modules/imagick.so

Step 5: Add imagick to the libraries that are loaded when php starts.
$ cd /etc/php.d
$ sudo vim 20-imagick.ini

You can use either vim or nano to create and edit the 20-imagick.ini file. When the file opens, enter the following lines (first line is just a comment describing file purpose).

; Enable ImageMagick extension module
extension=imagick

Step 6: Restart the php service (php-fpm in my case), and then restart the web service.
$ sudo systemctl restart php-fpm
$ sudo systemctl restart httpd
If all goes well, you should have ImageMagick installed and running on your server in 5 minutes or less.


$php -m|grep imagick
imagick

 

posted on 2024-01-30 18:17  遠離塵世の方舟  阅读(4)  评论(0编辑  收藏  举报

导航