LoginSignup
8
8

More than 5 years have passed since last update.

CentOS7 remi-php7とphp7用のimagemagickのインストールをyumで

Last updated at Posted at 2017-12-15

適当にやったらうまく行かなかったので、メモ。

環境

自分は、CentOS7 remi-php7.0でphp環境を作っている

remiでphpの環境を作るのはここが参考になります。:CentOS6/CentOS7にPHP5.6/PHP7をyumでインストール

  • phpのimagickは、ImageMagickのver6を使っていて、6.9.x以上じゃないとダメっぽい。
[vagrant@dev]$ pecl search imagick

Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
imagick 3.4.3 (stable)  3.4.3 Provides a wrapper to the ImageMagick library.

centos7のbaseレポジトリで探してもない

  • centos7のbaseレポジトリでは、ImageMagickは、6.7.8.9しかない。
[vagrant@dev]$ yum info imagemagick

// 省略
利用可能なパッケージ
名前                : ImageMagick
アーキテクチャー    : i686
バージョン          : 6.7.8.9
リリース            : 15.el7_2
// 省略
名前                : ImageMagick
アーキテクチャー    : x86_64
バージョン          : 6.7.8.9
リリース            : 15.el7_2
容量                : 2.1 M

なので、remiをenableにして複数バージョンのrpmを表示する

探したいものが見つかる。

[vagrant@dev]$ yum search imagemagick --showduplicates --enablerepo=remi
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
// 省略
ImageMagick6-devel-6.9.9.25-1.el7.remi.x86_64 : Library links and header files for ImageMagick app development
ImageMagick6-devel-6.9.9.26-1.el7.remi.x86_64 : Library links and header files for ImageMagick app development
ImageMagick6-devel-6.9.9.26-1.el7.remi.x86_64 : Library links and header files for ImageMagick app development
ImageMagick6-djvu-6.9.9.25-1.el7.remi.x86_64 : DjVu plugin for ImageMagick
ImageMagick6-djvu-6.9.9.26-1.el7.remi.x86_64 : DjVu plugin for ImageMagick
ImageMagick6-doc-6.9.9.25-1.el7.remi.x86_64 : ImageMagick html documentation
ImageMagick6-doc-6.9.9.26-1.el7.remi.x86_64 : ImageMagick html documentation
ImageMagick6-libs-6.9.9.25-1.el7.remi.x86_64 : Commands for ImageMagick
ImageMagick6-libs-6.9.9.26-1.el7.remi.x86_64 : Commands for ImageMagick
ImageMagick6-libs-6.9.9.26-1.el7.remi.x86_64 : Commands for ImageMagick
ImageMagick6-perl-6.9.9.25-1.el7.remi.x86_64 : ImageMagick perl bindings
// 省略
ImageMagick7-doc-7.0.7.14-1.el7.remi.x86_64 : ImageMagick html documentation
ImageMagick7-libs-7.0.7.13-1.el7.remi.x86_64 : Commands for ImageMagick
ImageMagick7-libs-7.0.7.14-1.el7.remi.x86_64 : Commands for ImageMagick
ImageMagick7-perl-7.0.7.13-1.el7.remi.x86_64 : ImageMagick perl bindings
// 省略ImageMagick-6.7.8.9-15.el7_2.x86_64 : An X application for displaying and manipulating images
ImageMagick6-6.9.9.25-1.el7.remi.x86_64 : An X application for displaying and manipulating images
ImageMagick6-6.9.9.26-1.el7.remi.x86_64 : An X application for displaying and manipulating images
ImageMagick6-6.9.9.26-1.el7.remi.x86_64 : An X application for displaying and manipulating images
ImageMagick7-7.0.7.13-1.el7.remi.x86_64 : An X application for displaying and manipulating images
// 省略
php54-php-magickwand-1.0.9.2-12.el7.remi.x86_64 : PHP API for ImageMagick
php54-php-pecl-imagick-3.4.3-1.el7.remi.x86_64 : Extension to create and modify images using ImageMagick
php54-php-pecl-imagick-3.4.3-5.el7.remi.x86_64 : Extension to create and modify images using ImageMagick
php55-php-magickwand-1.0.9.2-11.el7.remi.x86_64 : PHP API for ImageMagick
// 省略
php56-php-pecl-imagick-3.4.3-1.el7.remi.x86_64 : Extension to create and modify images using ImageMagick
php56-php-pecl-imagick-3.4.3-5.el7.remi.x86_64 : Extension to create and modify images using ImageMagick
php70-php-pecl-imagick-3.4.3-1.el7.remi.x86_64 : Extension to create and modify images using ImageMagick
// 省略
php72-php-pecl-imagick-3.4.3-4.el7.remi.x86_64 : Extension to create and modify images using ImageMagick
php72-php-pecl-imagick-3.4.3-5.el7.remi.x86_64 : Extension to create and modify images using ImageMagick

こんな。

合いそうなやつを選んでinstall

yum install ImageMagick6-6.9.9.26 ImageMagick6-devel-6.9.9.26 --enablerepo=remi

peclのimagickモジュールは、rpmから入れないで、peclコマンドから入れる

pecl install imagick

php.iniに読み込みを追加して

CentOS7はextensionごとにファイルが分かれてる

/etc/php.d/20-imagick.ini
extension=imagick.so

Apache再起動

systemctl restart httpd

サンプルスクリプトを動かしてみると動いた。

こちらを使わせてもらいました。
CentOSでPHPのImageMagickラッパーライブラリ、PECL::imagickを入れてWebPで出力してみる

8
8
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
8
8