Install for PHP 5.4 on Windows server

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
nils@iqweb.se
Posts: 7
Joined: 2013-12-20T01:39:42-07:00
Authentication code: 6789

Install for PHP 5.4 on Windows server

Post by nils@iqweb.se »

Trying to install Imagick.dll on Windows server for PHP 5.4 , but not sure of what verion of Imagick I should install
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Install for PHP 5.4 on Windows server

Post by Bonzo »

You want a version later than 3.1.0 as there was a compatability issue with php 5.4
I recived an error every time somebody visited my website and the error list grew very fast!
nils@iqweb.se
Posts: 7
Joined: 2013-12-20T01:39:42-07:00
Authentication code: 6789

Re: Install for PHP 5.4 on Windows server

Post by nils@iqweb.se »

Thanks for your help
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Install for PHP 5.4 on Windows server

Post by fmw42 »

I believe this may be the latest version of Imagick

http://pecl.php.net/package/imagick/3.1.0RC2
jaslee
Posts: 11
Joined: 2010-02-25T06:03:36-07:00
Authentication code: 8675308

Re: Install for PHP 5.4 on Windows server

Post by jaslee »

It took me several days to figure out the installation on Imagick on our Windows Server 2008 with PHP 5.3, no kidding. On a Linux server, it literally took a few minutes with "apt-get install..." etc.

The big lesson I learned is that it's all about VERSIONS for Windows:-

* Version of Imagick dll MUST match version of PHP
* Version of ImageMagick MUST match version of Imagick dll (NOT just the latest release)
* If you're a novice c/c++ programmer, don't waste time figuring out how to compile code from scratch (esp. with VS Express with no MFC support!)

1. If not already done, (initially) download and install the latest ImageMagick. I don't really know the significance but I opted for "Install development headers.." (http://www.imagemagick.org/script/binar ... hp#windows)

2. Create a PHP script with phpinfo() to find out your version of :-
a) PHP
b) Compiler version
c) Architecture (32/64-bit)
d) Thread Safety (enabled/disabled)

3. Search for Imagick dll which support your version of software as above. In my case, it was (a) PHP 5.3, (b) Compiler MSVC9 on (c) x86 ie. 32-bit platform with (d) Thread Safety disabled

4. There are quite a few sources for download but I think the "official" one is the PHP Pecl website: http://pecl.php.net/package/imagick

Down the list of versions you can see Windows icons next to some builds for downloading the dll. For me, I could see a version for PHP 5.3 NTS (Non-Thread Safe) here: http://pecl.php.net/package/imagick/3.1.2/windows

5. Once downloaded, you want to find out which version of ImageMagick it is based on. I couldn't find an obvious way to do this for the version I have, but I noticed the zip file also contains a load of CORE_xx.dll's which I copy and paste'd into the existing ImageMagick installation folder - then in a new cmd prompt, I type "IDENTIFY" to see the version of the CORE_xxx.dll's. In my case it is:-

"Version: ImageMagick 6.8.6-9 2013-08-17 Q16 ..."

6. Search for this version of ImageMagick, I found one ("ImageMagick-6.8.6-9-Q16-x86-windows.zip") on one of the ImageMagick mirror dowload sites: http://ftp.sunet.se/pub/multimedia/grap ... /binaries/

7. Either uninstall the current ImageMagick and download/install this matching version (to php_imagick.dll) OR I think it's fine to install multiple versions where the last install will be assumed default

8. Restart the server machine (required) to register the new ImageMagick and with any luck you should see the "imagick" section in phpinfo page created earlier.


I'm just posting my experience in the hope of benefitting others - also as a wiki for my own future reference!

Now that I have a working PHP Imagick on Windows I do notice some programming differences (further pain!) with the version I installed on a Linux server, for example it can't work out relative paths e.g.

Code: Select all

$im = new Imagick("myimage.png");
..doesn't assume the png file is in the same folder as the PHP script itself, I have to do:-

Code: Select all

$im = new Imagick("d:/mydevpath/myimage.png");
or

Code: Select all

$im = new imagick (__DIR__ . DIRECTORY_SEPARATOR . 'myimage.png');
Similar issue with a URL source (still have to figure that out)

Hope all this helps!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Install for PHP 5.4 on Windows server

Post by Bonzo »

Thanks for the info jaslee.
Post Reply