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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步