2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AlmaLinux8にImageMagick-develを導入する際のメモ

Last updated at Posted at 2021-06-08

メモ

AlmaLinuxにImageMagick、ImageMagick-develをインストールしないといけなくなったのでメモ。
使用目的としてはPHPでImageMagickを使いたい。

必要パッケージのダウンロード

wget https://repo.almalinux.org/almalinux/8/devel/x86_64/os/Packages/jasper-2.0.14-5.el8.x86_64.rpm
wget https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/jasper-libs-2.0.14-5.el8.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/ftp.centos.org/8.5.2111/PowerTools/x86_64/os/Packages/jasper-devel-2.0.14-5.el8.x86_64.rpm

rpm -ivh jasper-libs-2.0.14-5.el8.x86_64.rpm  jasper-2.0.14-5.el8.x86_64.rpm  jasper-devel-2.0.14-5.el8.x86_64.rpm
または、

rpm -Uvh jasper-libs-2.0.14-5.el8.x86_64.rpm  jasper-2.0.14-5.el8.x86_64.rpm  jasper-devel-2.0.14-5.el8.x86_64.rpm

ImageMagickインストールに必要な依存パッケージを先に入れてから、ImageMagick、ImageMagick-develを入れていく。

dnf install OpenEXR-devel jasper-devel ghostscript-devel lcms2-devel
dnf install ImageMagick ImageMagick-devel

PHPから、ImageMagickを使用したいので関連するものを入れていく。
pecl経由で連携させる。

dnf install php-pear php-devel
pecl install imagick

pecl install imagick 実行時に、
Please provide the prefix of ImageMagick installation [autodetect] :
と聞かれるのでエンターを押す。ビルドが始まるので、Build process completed successfullyと出れば成功。
You should add "extension=imagick.so" to php.ini ともでてるのでphp.iniに下記を追記。

# vim /etc/php.iniの末尾に追記
[PECL]
extension=imagick.so

他、POST経由でImageMagickを使用する際は、サイズを増やしておくことを忘れない。

upload_max_filesize = 20M
post_max_size = 20M

Apacheをgrecefulで再起動させ、php -m で読み込まれているモジュール一覧に、imagickがあれば読み込まれていることになる。

httpd -k graceful
php -m 
php -a
echo ini_get('post_max_size');
20M
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?