How to install ImageMagick to use with PHP on Windows 7 (3)

青春壹個敷衍的年華 提交于 2019-12-17 10:29:33

问题


There are other threads about how to install Imagick on Windows 7 but no help for me so far. :(

(Maybe problems have came up with more recent versions)

I have followed these steps to install:

  1. Download and install ImageMagick

    http://www.imagemagick.org/download/binaries/ImageMagick-6.8.8-1-Q16-x86-dll.exe

  2. Download php_imagick.dll and copy to extension dir (c:\xampp\php\ext)

    http://www.peewit.fr/imagick/php55/vc11/x86/ts/php_imagick.dll

  3. Edit php.ini file and add new extension (c:\xampp\php\php.ini)

    extension=php_imagick.dll

  4. Save ini file and restart Apache (if necessary, restart Windows)

  5. Start Apache and run test

When I start Apache i get a pop up box that displays:

The program can't start because php5.dll is missing from your computer. Try reinstalling the program to fix this problem.

Then directly after this comes another:

PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found.

According to funtioneer I suspect some kind of compilation error.

Now I have PHP Version 5.5.6 (xampp 1.8.3) with compiler MSVC11 wich is the same as for the php_imagick.dll file.

Is download ImageMagick from source and compile it on my own the right way to go? (have never compiled in Windows before)


回答1:


Instead of using the latest version I tried downloading ImageMagick-6.7.7-5-Q16-windows-dll from here. That one actually worked with the php_imagick.dll (Imagick for PHP 5.5.x) from http://www.peewit.fr/imagick/.

This is not the latest version but it worked. (even without restarting the computer)




回答2:


Here what finally worked for me after trying almost every possible solution posted in internet:

Environment:

OS: Windows Server 2008 R2 (64bit)

IIS: 7.5

PHP: 5.5.11 (x86)

PHP.ini: VC11, x86

Download and install ImageMagick

ImageMagick-6.8.9-1-Q16-x86-dll.exe

Download corresponding .zip from Anatol suggested sources (kudos to Anatol!)

ImageMagick-6.8.9-1-vc11-x86:

Extract to a temporary folder and copy the contents of the "bin" folder inside the Imagemagick installation (c:\imagemagick) in my case overwriting files.

Download .dll and put it in the php extensions folder (I used this one)

Imagick for PHP 5.5.x Non Thread Safe from: http://www.peewit.fr/imagick/

Add the extension to php.ini with:

extension=php_imagick.dll

Save php.ini and restart IIS

Finally Image Magick information was displayed in a phpinfo(); call.

It is incredible to think to solve this problem needed to download files from 3 different locations.

Hope it helps.




回答3:


Here is what I did to get it working Note: The step that really tripped me up that didn't really explain is that the php_imagick.dll version should match your install of imagick

Ok so steps I taken was download php imagick dll from http://windows.php.net/downloads/pecl/releases/imagick/3.1.2/ (I used php_imagick-3.1.2-5.5-ts-vc11-x86.zip)

The zip file will contain many dlls keep this in mind, we may need it in future. Extract php_imagick.dll to your extension folder

Put that in extension folder

IN php.ini add extension = php_imagick.dll

Now the issue is we need to find out what version of imagick the php_imagick.dll was compiled for Open command prompt and type in php -e -v The way I did this was with the zip you downloaded earlier, extract the other DLLs to your php folder an error message will probably popup stating something about missing dlls. So extract the DLLs from the zip folder from before into your PHP folder. Try running php -e -v again and it should work fine with no error message. If that is the case then Restart apache. Now look at phpinfo() and go to the imagick section. It will say ImageMagick version: Mine said ImageMagick 6.8.6-8 which is an older version then they have on their site. The issue is that ImageMagick number of supported formats: will probably say zero.

Go here and download the matching version and install (when you install make sure the checkbox of adding to path variable is checked)

Once finish installing Stop apache. Delete the DLLS from the php folder that you put in earlier and start apache again. Check restart apache and it should all work.




回答4:


The ImageMagic distribution which should be used is from here http://windows.php.net/downloads/pecl/deps/ . The ImageMagic binaries need to be built with the same CRT as the PHP extension is.




回答5:


Please see installing-imagick-php-7 for installing imagick php extension on Windows using php 7.0 +. It's only real solution I have found so far. It goes into great detail.




回答6:


UPDATED: 21.08.2017

I got worked ImageMagick with php 7 and IIS (Apache very similar): Imagick Version. 3.4.3

PHP 7 nts x86, Windows Server 2012 x64, IIS 8.5

1) Install VC++ 2015 https://www.microsoft.com/en-US/download/details.aspx?id=48145

2) Get ONLY php_imagick.dll from https://pecl.php.net/package/imagick

3) Put it into php/ext/ folder and add extension=php_imagick.dll to php.ini

Attention! Minimum versions supported PHP >= 5.4.0 and ImageMagick >= 6.5.3-10.

ImageMagick 7 are not supported at this time.

Look at phpinfo:

You must install ImageMagick 6.9.3-7 Q16 x86 4) install ImageMagick 6.9.3-7 Q16 x86 dll from http://ftp.icm.edu.pl/packages/ImageMagick/binaries/ Do not uncheck "add variable to path".

5) restart server

thats all




回答7:


It works by following steps.

php 5.5 32bit ts+apache 2.4+windows 10 64bit+Imagick 6.9.3-5+php_imagick.dll ts

Check what's bit of your system bit.

Choose a php_imagick.dll version from http://windows.php.net/downloads/pecl/releases/imagick/

Find php_imagick.dll from .zip file

If you don't know how to choose.

Type php -v get php version at commandline window

Run following code shows which kind of php you have installed,thread safe or non thread safe.and click here will help you.

On windows:php -i|find "Thread"

On Linux:php -i|grep Thread

or you can run function phpinfo() and search "Thread" on web page.

You will see Thread Safety enabled or Thread Safety disabled

Other steps have already been written out by @embe.




回答8:


Now for something the documentation does not mention: setting the MAGICK_HOME value in your environment. ImageMagick requires this variable so it knows where to find all relevant coders.

Open up the control pannel, and search for 'PATH'. In the results, select 'Edit the system environment variables'. Select the 'Environment variables...' option, and add a new 'System variable' (the lower list). If you've chosen a different installation path, make sure to replace C:\img with your own path.

Variable: MAGICK_HOME

Value: C:\img\modules\coders

see more




回答9:


Solved!

After having the same problems and some googling I found the solution for windows, and it seems to work for every release as well.

In my case PHP is installed at c:\php and my extension dir is at c:\php\ext.

  1. Copy "php_imagick*" into c:\php\ext
  2. Copy "CORE_RL_*", "FILTER_*", "IM_MOD_*" into c:\php
  3. Add "extension=imagick" to php.ini

Restart apache and your done.



来源:https://stackoverflow.com/questions/20976779/how-to-install-imagemagick-to-use-with-php-on-windows-7-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!