How do you build the PHP Imagick extension on windows with PHP 5.4?
I've built the extension on windows 7, against the latest release of
ImageMagick - 6.8.6. It seems to load fine. It shows up with all the bells
and whistles in phpinfo(), but when I try and use it to load an image
file, it crashes somewhere in msvcrt100.dll -- calling fstat64.
Is there something I've missed here?
EDIT: Nevermind. See below for the solution.
The issue was that the latest version of ImageMagick was built using VC10,
but PHP is built using VC9 -- I needed to download the imagemagick source
distribution and build it using VC9, and link against that in order for
the extension to work properly.
Forgive the mangled links, I don't have any rep.
Step 1: Set up the PHP build as outlined in
wikiphpnet/internals/windows/stepbystepbuild - Stop before it has you run
configure.
Step 2: Download the imagick pecl extension source and unzip it to the
/ext directory of the PHP source tree. You need to have the imagick source
in /ext/imagick. peclphpnet/package/imagick
Step 3: Build ImageMagick using VC9 (VS2008). Follow these instructions:
wwwimagemagick.org/script/install-source.php#windows
Step 4: Copy the following files from the ImageMagic source directory to
the PHP deps directory (C:\php-sdk\phpdev\vc9\x86\deps),
copy to deps\lib:
ImageMagick-source\VisualMagick\lib\CORE_RL_magick_.lib
ImageMagick-source\VisualMagick\lib\CORE_RL_Magick++_.lib
ImageMagick-source\VisualMagick\lib\CORE_RL_wand_.lib
ImageMagick-source\VisualMagick\lib\X11.lib
copy to deps\include\magick
ImageMagick-source\magick\*.h
copy to deps\include\Magick++
ImageMagick-source\Magick++\lib\Magick++\*.h
copy to deps\include
ImageMagick-source\Magick++\lib\Magick++.h
copy to deps\include\wand
ImageMagick-source\wand\*.h
copy to deps\bin
ImageMagick-source\VisualMagick\bin\CORE_RL_magick_.dll
ImageMagick-source\VisualMagick\bin\CORE_RL_Magick++_.dll
ImageMagick-source\VisualMagick\bin\CORE_RL_wand_.dll
ImageMagick-source\VisualMagick\bin\X11.dll
Step 5: Run php's configure script with the following command line:
configure --disable-all --with-imagick=shared --disable-zts --enable-cli
Step 6: Make PHP with Imagick extension - in the php source directory, as
outlined in the PHP build instructions:
nmake
Step 7: At this point, all you need from the PHP build Release directory
is php_imagick.dll -- you can include the pdb if you need the debugging
symbols, but you knew that already. Put php_imagick.dll in the \ext
directory. Copy ImageMagick-source\VisualMagick\bin*.dll to .
Step 8: Run phpinfo() and hopefully you'll see the magick.
No comments:
Post a Comment