LoginSignup
7
8

More than 5 years have passed since last update.

PECL ImageMagick(PHP)インストール手順

Posted at

ImageMagick

Imagick は、ImageMagick API を使用して画像の作成や修正を行う ネイティブ PHP 拡張モジュールです

通常、下記のコードでインストールできるみたいですが、
やたらエラーを吐いたので、メモ。
pecl install imagick

インストール手順

  • 0~5は、pearインストール?(とばしても大丈夫?)
  • 6~8が、imagickのインストール
  • 6でやたらコケたので、pear/ファイルでのインストール手順を後述しました。

0) pearインストール済み?確認:インストール
0-1)which pear
0-2) yum -y install php-pear
1) yum install php-devel
2) phpの場所確認→移動
2-1) which php
2-2) cd /usr/bin
3) wget http://pear.php.net/go-pear.phar
4) php go-pear.phar
5) php.ini の編集。以下の行を追加。
include_path=".:/usr/PEAR"

6*) pecl install imagick
7) php.ini の編集。以下の行を追加。
extension=imagick.so
8) service httpd restart

============
◆peclでインストール

6-1) pecl install imagick
#こけた WARNING: You will need re2c 0.13.4 or later
#re2cをインストール(ホームディレクトリで作業)
6-a-1) wget https://github.com/skvadrik/re2c/releases/download/0.16/re2c-0.16.tar.gz
6-a-2) gzip -dc re2c-0.16.tar.gz | tar xvf -
6-a-3) cd re2c-0.16
6-a-4) ./configure
#こけた depcomp: line 571: exec: g++: not found
#yumでインストール
6-a-a-1) yum install gcc-c++

6-1)pecl install imagick
#こけた ERROR: `/var/tmp/imagick/configure --with-php-config=/usr/bin/php-config --with-imagick' failed
#うーん configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
6-b)yum install ImageMagick-devel
6-1)pecl install imagick
#できた!

============
◆ファイルから
参考(コメ欄):http://php.net/manual/ja/imagick.installation.php
6-) wget http://pecl.php.net/get/imagick-3.4.3RC1.tgz
6-
) gzip -dc imagick-3.4.3RC1.tgz | tar xvf -
6-) cd ./imagick-3.4.3RC1
6-
) phpize
6-) ./configure --with-imagick=/opt/local
# こけた WARNING: You will need re2c 0.13.4 or later
# → ◆peclでインストール[6-a]参照
6-
) make
6-1) make install

■参照
http://www.imagemagick.org/
http://php.net/manual/ja/book.imagick.php
http://www.image-magick.com/
(http://www.ghostscript.com/)

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