ImageMagickがXAMPPで動かなくてVC9で揃えた話

WindowsXP上のXAMPPでphpからImageMagickを使おうとしたらApacheがクラッシュしまくりでした。問題の根本はVisual C++のランタイムとの兼ね合いとのこと。

http://valokuva.org/?page_id=50 (ページはいつか動くと思うので適宜移動してください)

#10 by Mitron on May 26, 2011 - 4:04 pm

As Mikko has stated many times, to make all this work, Apache, PHP and Imagemagick all have to be built with the same Visual Studio version on Windows. So, unless you have Visual Studio and know how to use it, you will have to track down all three applications built with the same version of Visual Studio.

(以下略)

apache/php/imagemagick全部VC9版で揃えたら無事動き出しました。XAMPPなのでapacheとphpはツガイでphpのバージョンは5.3.8です。

WindowsXP (32bit) SP3
Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161

xampp-win32-1.7.6-VC9.zip
ImageMagick-6.6.2-9-Q16-windows-dll.exe
2011-04-25 18:49のphp_imagick_ts.dll
php.iniにextension=php_imagick_ts.dllを追記してdllを既存のxampp\php\ext下に置く

CORE_RL_wand_.dll was not foundとか出る場合は、ImageMagick本体のパスまわりがオカシイので、zip版で意地を張ったりせずにインストーラ版を使ってください。

php.iniの場所が云々という情報をみかけますが、吊るしのxampp-win32-1.7.6-VC9.zipにはphp.iniは1つしか入ってなくてそれを編集すればいいです。extension=の部分が効いてればphpinfo()でImageMagickの項目が出てくるはずです。

htdocsに以下のphpを置いて、c:\に適当なsample.jpgを作れば表示されます。realpathがどうのこうのウダウダ書いてある巷の情報は無視できます。男ならサクっとc:\。

<?php
$image = new Imagick('c:\sample.jpg');
$image->thumbnailImage(80, 0);

header("Content-type: image/jpeg");
echo $image;
?>

Popular posts from this blog

Thunderbirdのフィルタで正規表現

Windows10にTeratermを新規で入れたら文字化けしてUTF-8の設定もできない→日本語設定にしてフォントの文字セットも変更すると直る

2つのXMLドキュメントの結合 (java)