开发者

Installing ImageMagick extension with php/windows

Running PHP Version 5.2.5 on Windows Server 2003 with IIS.

Have virtually an identical server where we were able to install ImageMagick with no issues. It's running exactly the same version of php. Used the following steps to install, but it just won't seem to work on this server. ImageMagick itself is installed but php won't load the extension.

We've spent hours trying to get the extension installed. It just won't show up in phpinfo().

INSTALL STEPS TAKEN

To install IMagick on Windows XP (PHP 5.2.x)

  1. download and install ImageMagick-6.5.8-7 Q16-windows-dll.exe http://www.imagemagick.org/download/binaries/ImageMagick-6.5.8-7-Q16-windows-dll.exe

  2. download php_imagick_dyn-Q16.dll from http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/

    copy DLL to [PHP]/extension dir and rename it to php_imagick.dll

  3. You have to edit your php.ini file and add the new extension:

    extension=php_imagick.dll
    
  4. Save php开发者_如何学JAVA.ini and restart Apache server. (If necessary, restart Windows)

  5. phpinfo() should show imagick enabled.


Found very useful tha answer given by user Buttercup, also if he could be more clear.

My scenario was a Windows 2012 R2 x64, PHP 5.5.19 x64 and need to install ImageImagick with PHP support. Following points here below I was able to install ImageImagick 6.9.0 x64 and PHP_Imagick.dll 3.1.2 (both are currently the latest stable versions).

Please note I downloaded all components (PHP, ImageImagick and PHP_Imagick) in NTS and x64 modes: not in TS and/or x86 modes. I don't know if this apply in your own case.

The point it wasn't clear for me reading the Buttercup (as for user RhoVisions) was his comment: "Overwrite the DLLs found from ImageMagick 6.8.8 Windows version with the PHP version".

So, this is what I've done (based on Buttercup solution, who I have to say again and again thank you very much!):

  1. download latest ImageMagick EXE installer from Link In my case I downloaded the first file available as HTTP download labeled "Win64 dynamic at 16 bits-per-pixel" (filename: ImageMagick-6.9.0-0-Q16-x64-dll.exe)

  2. Run the installer just downloaded. I installed it in a simple path like C:\ImageMagick6.9.0 (but I don't think it is so important to move it away from Program Files). Also, I didn't change any other parameter from their defaults during installing.

  3. download latest PHP_Imagick DLL file from PECL website at: http://pecl.php.net/package/imagick I choosed a stable (not Beta or RC) version, in my case 3.1.2, clicking on the "Windows logo"+"DLL" label. In my case it was linked to ht tp://pecl.php.net/package/imagick/3.1.2/windows . On the page it will open you'll find a table: you have to choose your file depending on: a) number of version of PHP you have (in my case there were available DLLs for PHP 5.3, 5.4, 5.5, 5.6) b) x64 or x86 version of PHP you have c) NTS or TS version of PHP you have My case is was PHP 5.5.x, x64, NTS: so I downloaded the one labeled "5.5 Non Thread Safe (NTS) x64" (file name: php_imagick-3.1.2-5.5-nts-vc11-x64.zip)

  4. Unzip the php_imagick ZIP and: a) copy php_imagick.dll file into the EXT folder of your PHP installation b) copy and replace ALL the CORE_RL_.dll from the folder you just unzipped into the folder you choosed at point #2. Obviously, please backup replaced files. In my case I copied 8 CORE_RL_.dll files from unzipped folder to C:\ImageMagick6.9.0. I leaved into C:\ImageMagick6.9.0 the others CORE_RL_*.dll not overwritten.

  5. Edit and save your PHP.ini file in order to add this simple row: extension=php_imagick.dll

  6. Reboot your server (unfortunally I didn't find any good alternative of a reboot: also a IISRESET from admin command-prompt didn't work).

  7. When reboot finished, visit remotely by browser your phpinfo.php file in order to verify that Imagick module was ok. In my case it was.

Hope this could help, out there!


I found an alternate source. PECL direct downloading.

Install Steps taken

ImageMagick installation

Where to download latest ImageMagic compatible with IIS 8.1 / Windows 2012r2 php x64:

http://windows.php.net/downloads/pecl/deps/

navigate and download: ImageMagick-6.8.8-vc9-x86.zip for PHP 32-bit, 5.4.xx

ImageMagick-6.8.8-vc11-x86.zip for PHP 32-bit, 5.5.xx

ImageMagick-6.8.8-vc11-x64.zip for PHP 64-bit, 5.5.xx

Tips:

  • Overwrite the DLLs found from ImageMagick 6.8.8 Windows version with the PHP version.

  • You need to reboot if files are locked in memory.

php_imageMagick.dll location

http://windows.php.net/downloads/pecl/releases/imagick/

download the appropriate DLLs.

You get latest version of ImageMagick DLLs, php_imagemagick.dll (both non-thread-safe and thread-safe versions).

Tip:

  • If you get php5ts.dll missing, you downloaded the wrong version of php_imagemagic.dll and download other version.

  • if you are using IIS - use 'NTS' version - php_imagemagick_nts.dll

  • if you are using Apache - use 'TS' version - php_imagemagick_ts.dll


In windows you should check 3 parameters when you want to add an extension to php server:

  1. The compiler version which your php server compiled with (VC9 or VC10) which is indicated in phpinfo().

  2. The PHP extension API number which is indicated in phpinfo().

  3. The most important parameter is whether your web server is ts (thread safe) or nts (non thread safe) which is indicated in phpinfo().

I found to my experience that IIS is nts by default and the php extension should be compiled with nts php library in order to work properly in your web server. However, your extension and your php web server should be the same exactly in these three parameters if you want to load your extension properly.


This is an older question, but I've ran into similar issues with PHP/IIS before. A couple things I could suggest to double check:

  • Use the phpinfo page to see if you're editing the right php.ini file, look at the "Loaded php.ini file" on the first page (as stupid as it sounds, I've done that before - sometimes PHP will look for it in its own folder, sometimes C:\Windows)
  • also try to enable display_errors to On and error_reporting to E_ALL in php.ini and see if there are error messages at the very bottom of the phpinfo file. Typically it will at least acknowledge not being able to load your DLL.


On both http://www.imagemagick.org/download/binaries/ and http://valokuva.org/outside-blog-content/, there are multiple DLLs files: one for x64 and another for x86. If your Windows XP is 32-bit, you need to try x86 DLL.


You do not need to restart windows. You need to restart the application pools running the PHP exe. This can be done by either resetting IIS (This is the best option to get all the application pools to reset). Or recycle the application pools that are running PHP.


nothing worked until I set the permissions on the imagick folder and c:\windows\temp (IUSR read/execute for imagick, read/write/execute for windows\temp).

* I'm not 100% sure read/write/execute was necessary for windows\temp but it was listed on a site somewhere during my google surfing *

Pretty sure the rebooting part is just to make sure the imagick folder is in your system path directory and showing up in phpinfo(), it was already in my path so I didn't have to reboot after setting the permissions.


It's quite complicated to match the imagick extensions to their base and to the PHP version. So, in order to take out the hassles of the installation, i would suggest to use a server stack which ships Imagick and it's extension, like WPN-XM.


I know that it is old question but I got here by google so probably other will too. For them here is a quickest and easiest solution: https://mlocati.github.io/articles/php-windows-imagick.html

It worked for me and it is much easier then most voted answers here (and which seemed too complicated for me, like installing imagick as cmd.com command - what for?)


In my case Windows restart (mentioned in step 4) did the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜