CakePHPでサムネイル画像を作るが使いたかったので、CentOSにImageMagickをインストールしてPHPで使えるようにしてみた。
# wget -O go-pear.php http://pear.php.net/go-pear # php go-pear.php ... # cd /usr/lib/php/bin -rwxr-xr-x 1 root root 784 4月 8 10:35 pear -rwxr-xr-x 1 root root 805 4月 8 10:35 peardev -rwxr-xr-x 1 root root 721 4月 8 10:35 pecl
pearインストール完了。
というか、入れてから気づいたけど
# yum install php-pear
でいけるよね・・・。
とりあえずこの状態だとパスが通ってないので、bashにパスを追加。
# vi ~/.bash_profile
#PATH=$PATH:$HOME/bin PATH=$PATH:$HOME/bin:/usr/lib/php/bin
ログインし直すか、
# source ~/.bash_profile
で設定を再読み込み。
# pecl install imagick ... ERROR: `phpize" failed
このエラーはphpizeが入っていないことによるエラーらしいので、php-develをインストール。
# yum install php-devel
する。
んでもってインストール再開。
# pecl install imagick ... checking whether to enable the imagick GraphicsMagick backend... no checking ImageMagick MagickWand API configuration program... found in /usr/bin/Wand-config checking if ImageMagick version is at least 6.2.4... configure: error: no. You need at least Imagemagick version 6.2.4 to use Imagick. ERROR: `/usr/lib/php/temp/imagick/configure --with-imagick" failed
アッー!
# yum list | grep ImageMagick ... ImageMagick.i386 6.0.7.1-17 installed ImageMagick.i386 6.0.7.1-20.el4 base ImageMagick-c++.i386 6.0.7.1-20.el4 base ImageMagick-c++-devel.i386 6.0.7.1-20.el4 base ImageMagick-devel.i386 6.0.7.1-20.el4 base ImageMagick-perl.i386 6.0.7.1-20.el4 base # yum install ImageMagick ... Updated: ImageMagick.i386 0:6.0.7.1-20.el4 Complete!
再開。
# pecl install imagick ... checking if ImageMagick version is at least 6.2.4... configure: error: no. You need at least Imagemagick version 6.2.4 to use Imagick. ERROR: `/usr/lib/php/temp/imagick/configure --with-imagick" failed
yumではVer.6.0.7がインストールされている。
よく見たら、「6.2.4以上を入れろ」と・・・。
仕方ないのでソースからコンパイル。
# wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz ... # tar zxvf ImageMagick.tar.gz ... # cd ImageMagick-6.5.1-0/ # ./configure ... # make ... # make install
今度こそ。
# pecl install imagick
できたっぽい。