54

There don't seem to be any concise tutorials/walk throughs for installing ImageMagick on WAMP for use with PHP.

I've tried dozens of combinations of their binary releases with different php extension dll files. I can get imagemagick working fine from the command line, and I can get it to show as ticked in the WAMP extensions, but can't actually use it.

Has anyone come across a good guide for installing this ball ache piece of software?

I've followed http://www.knowledge-transfers.com/it/installing-imagemagick-on-windows-setup-imagick-on-php with no luck...


Update: this is what happens when I follow the steps in PHP farmer's answer on windows7. My php.ini is setup as follows:

extension_dir = "c:/wamp/bin/php/php5.3.0/ext/"

extension=php_imagick.dll

I reboot and get these two errors in this order

alt text alt text

and here is the dll file where it should be:

alt text

Sinister Beard
  • 3,570
  • 12
  • 59
  • 95
Haroldo
  • 36,607
  • 46
  • 127
  • 169
  • Does your `error.log` show anything useful ? – nc3b May 31 '10 at 09:16
  • afraid not, I'm amazed at how little documentation there is for this, would have though it was quite a common task... – Haroldo May 31 '10 at 09:49
  • What are you trying to install exactly, the ImageMagick executable or the PHP extension? – Pekka May 31 '10 at 13:00
  • @Haroldo - What is your `extension_dir` defined in the php.ini ? And `extension=?` ? Does your DLL readable/excutable by apache user ? – ajreal Dec 14 '10 at 18:18
  • What PHP version are you running? I was never able to get it to work w/PHP 5.2, but 5.3 should be possible. I just migrated our goddamn server over to Linux; problem solved :) – El Yobo Dec 14 '10 at 23:32
  • @ajreal - `extension=` is set, but hadn't checked `extension_dir` will look at that, what should it say? `phpinfo()` shows imagemagick in `PATHS` but not as a module... – Haroldo Dec 15 '10 at 14:22
  • imagick is consider part of the module, because u have set extension=something,, but you shoud ensure `imageick*.dll = path to extension_dir+extension`, and make use is executable by apache user – ajreal Dec 15 '10 at 14:25
  • I've checked and `extension_dir` is correct, and the correct dll is in that directory. What do you mean by ` make use is executable by apache use` . Thanks! – Haroldo Dec 15 '10 at 16:57
  • In windows, right click the DLL->Properties->Security, does `Read & Execute` is enabled for apache user ? **(NOT THE WINDOW USER)** – ajreal Dec 15 '10 at 20:29
  • Some dumb suggestions: 1) Maybe the path should start with a capital C. 2) Maybe it will help to restart the server. 3) Maybe it will help to restart the computer (exit and then start). – Geoffrey Dec 21 '10 at 11:43

8 Answers8

72

I know this is old post but I spend my all day to make it work, so here are the steps that helped me:

  1. Download ImageMagick Binary Release - http://www.imagemagick.org/script/download.php
  2. Install in C:\imagemagick, on last step check "Add application directory to your system path"
  3. Download Imagick DLL: PHP5.6.x version from http://www.peewit.fr/imagick/ (I have 5.6+ version installed on my localhost
  4. Copy php_imagick.dll to C:\wamp\bin\php\ext
  5. Download PHP 5.6 Thread Safe (TS) x86 version from http://pecl.php.net/package/imagick/3.1.2/windows
  6. Copy CORE_RL_* files to C:\wamp\bin\apache\bin\
  7. Edit php.ini file in C:\wamp\bin\apache\bin\php.ini, add extension=php_imagick.dll line in extensions section
  8. Copy all files from C:\imagemagick\modules\coders and C:\imagemagick\modules\filters to C:\imagemagick to load ImageMagick supported formats
  9. Go to Control Panel -> System -> Advanced Settings -> Environment Variables -> New System Variable -> MAGICK_HOME = C:\imagemagick
  10. Restart Wamp server and check phpinfo() for imagick plugin
  11. If last step does not work, restart Windows
Community
  • 1
  • 1
fsasvari
  • 1,891
  • 19
  • 27
  • 1
    Well done for taking the time to help other folk out - have my vote :-) – Mark Setchell Mar 05 '15 at 10:46
  • Thanks! I edited answer, added new number 8. It worked first time but in phpinfo() did not see supported formats, now it's everything ok. – fsasvari Mar 05 '15 at 11:55
  • this answer can not be accepted as the answer since OP is using PHP 5.3 – Abel Callejo Aug 28 '15 at 13:01
  • You are a saviour, saved tons of time. – Ashok Vishwakarma Sep 27 '15 at 20:16
  • I don't think step 6 (Copy CORE_RL_* files to C:\wamp\bin\apache\bin\) is needed, I tested and seems to be working without those files. Anyone can explain why this step would be necessary? – bg17aw Jan 04 '16 at 01:00
  • The only guide out of whole internet helped me Thanks mate :) – Seeker Mar 06 '16 at 14:08
  • @fsasvari, i have tried your example, but phpinfo still shows 0 supported formats, i even copied all dlls to windows/system32 and Apache bin directory, neither works ;( – Zakir_SZH Nov 01 '16 at 06:44
  • please help me out, as it is a crying need for me :( – Zakir_SZH Nov 01 '16 at 06:50
  • @Zakir_SZH have you followed all the steps ? – fsasvari Nov 02 '16 at 07:35
  • @fsasvari, thanks for getting back to me, i am sorry to say, yes i followed all your step, even restarted my computer didn't work. but i don't know why, this soltion work http://stackoverflow.com/questions/20976779/how-to-install-imagemagick-to-use-with-php-on-windows-7-3?rq=1 (2nd answer) – Zakir_SZH Nov 03 '16 at 05:59
  • 1
    Please note that installing the newest version of ImageMagick Binary Release might not be a good idea: http://stackoverflow.com/a/40217258/2366136 – Jorr.it Jan 03 '17 at 13:24
  • Thank you! This was driving me nuts! I was already considering setting up a linux box just for the development server! – Limiter Feb 28 '17 at 20:43
  • please note that step 6 is not 100% correct, the reason why it works is because the apache bin directory is already in system PATH, the correct wordings are the CORE* dlls need to be in a folder that is registered to the system PATH, in my case is the php bin folder, please read this link https://herbmiller.me/2016/06/16/installing-imagick-php-7/ – am05mhz May 30 '17 at 07:01
  • 1
    Update 2020: While still using the step-by-step guide above, I successfully installed imagick 3.4.4 for Windows Non Thread Safe (NTS) x86 on Windows Server 2012 R2 and using ImageMagick 6.9.* (not 7.0) – Jorr.it Mar 28 '20 at 15:49
  • 1
    At last! Tried everything. Step 6 did the trick. Copy all CORE_* files to my apache/bin folder on Windows 10. Or was it the fact I now used imagick v3.1.2 instead of v3.4.2? Thanks! – Gabe Hiemstra Jun 02 '20 at 12:52
25

I have improved fsasvari answer to cater general scenarios and versions. All credits to him.

Install Imagick in WAMP

  1. Open your phpinfo() page
  2. Check the below
    PHP version (mine : 5.5.12)
    Compiler (mine : MSVC11 (Visual C++ 2012) )
    Architecture : (mine : x64)
    Thread Safety : enabled
    Loaded Configuration File (mine : C:\wamp\bin\apache\apache2.4.9\bin\php.ini)
    extension_dir : (mine : c:/wamp/bin/php/php5.5.12/ext/)
    Apache Bin (Not in phpinfo() page) : C:\wamp\bin\apache\apache2.4.9\bin\

  3. Get the latest release match to your architecture from here (for me it was ImageMagick-x86_64-pc-windows.exe).

  4. Copy all files from C:\imagemagick\modules\coders and C:\imagemagick\modules\filters to C:\imagemagick to load ImageMagick supported formats

  5. Install in C:\imagemagick, on last step check "Add application directory to your system path"

  6. Download the PECL matching to your architecture http://pecl.php.net/package/imagick/3.1.2/windows (for me : 5.5 Thread Safe (TS) x64)

  7. Extract it and copy all the CORE_RL_* files to apache bin folder (mine : C:\wamp\bin\apache\apache2.4.9\bin)

  8. Copy php_imagick.* files to extension dir (mine : c:/wamp/bin/php/php5.5.12/ext/)

  9. Edit php.ini file (mine : C:\wamp\bin\apache\apache2.4.9\bin\php.ini)
    add extension=php_imagick.dll line in extensions section

  10. Go to Control Panel -> System -> Advanced Settings -> Environment Variables -> New System Variable -> MAGICK_HOME = C:\imagemagick

  11. Restart Wamp server and check phpinfo() for imagick plugin

  12. If last step does not work, restart Windows (Specially if you have previously installed imagemagick in different folder/version)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
MudithaE
  • 577
  • 5
  • 6
  • Finally this worked for me too, on Windows 8.1 x64, with Imagick 6.6.5. Adding the MAGICK_HOME variable wasn't needed in my case. – Sorin C Jan 03 '16 at 12:52
  • Why is step 7 (copy all the CORE_RL_* files to apache bin folder) needed? Seems to be working without it on mine machine. – bg17aw Jan 03 '16 at 14:40
  • Worked for me, BUT: - make sure to have a fresh installation, if necessary deinstall everything from former attempts first. One indicator for having the wrong architecture (x86/x64): the startup error is shown in the apache error log BUT without message! – Giehl Man Feb 17 '16 at 16:43
  • 5
    For those with this setup: - win 10 x64 - php 5.6 - PECL imagick 3.4.1 - ImageMagick 7.0.1 ...and got PHP startup error **The specified module could not be found**, you have to fallback to **ImageMagick 6.9.3** instead which can be found [here](http://www.imagemagick.org/download/binaries/) At least this is the solution for my case after hours of mental torturing lol – Fahmi May 02 '16 at 12:34
  • I had this working in apache, but not at CLI. Turns out I'd missed Step 7 and so got the "specified module could not be found error". For my UniformServer setup, copying the CORE_RL_* files to C:\UniformServer\core\php56 got me up and running. – Andy Place Sep 01 '16 at 09:28
  • Mark this like correct please, the only one make me working with imagemagick on Windows 7 and WAMP 2.5. Thanks!! – jjgarcía Jun 27 '17 at 00:28
21

For WAMPSERVER 3.1.9 64bit, PHP Version: 7.3.5

I had a lot of trouble with this as well and some things I did wrong was that I doubted ImageMagick would load on my new php version. But you have to believe it will work and don't try with older php versions :)

So this was my approach, remember to follow it with your own settings and versions/folders.

Before you start, make sure you running the php version you want to run. If you installed Wampserver 3, you may click the wamp icon and go to php version and activate the one you want to run.


1

Get latest ImageMagick version for your system here: http://ftp.icm.edu.pl/packages/ImageMagick/binaries/

(I got the ImageMagick-x86_64-pc-windows.exe in the bottom)


2

Install ImageMagick in C:/imagemagick (I put it in lower cases), You will be asked for some stuff during install, just make sure the path thingy is ticked.

You should also tick the convert thingy if it allows you.

Then after install you can run CMD and type convert -version to see if imagick is installed.


3

Run <?php phpinfo(); ?> And find out these settings:

PHP Version: 7.3.5

System: Windows

Compiler: MSVC15 (Visual C++ 2017) ([VC15])

Architecture: x64 (or maybe you have x86)

Thread Safety: enabled ([TS] else [NTS])

You probably have other settings, but you need to remember yours to download the proper php_imagick.dll


4

Get the php_imagick.dll you want for your php version from here: http://pecl.php.net/package/imagick

I got mine from here: http://pecl.php.net/package/imagick/3.4.4/windows for php 7.3

Remember your info from the phpinfo(), it has to match, else it won't work.


5

After you unzip it, copy the php_imagick.dll and paste it in C:/wamp64/bin/php/php7.3.5/ext/

Then copy all the other .dll files from that folder into C:/wamp64/bin/apache/apache2.4.39/bin/

Yes it's dirty but you will get it working like this.


6

Add extension=php_imagick.dll in C:/wamp64/bin/php/php7.3.5/phpForApache.ini

I added it after the other extensions in the file.


7

Restart all Wamp services.

If you been messing around earlier with installs, you might have to restart the computer due to some weird cache stuff.


8

Check phpinfo() again if imagick shows up and try something like $im = new Imagick();


9

Click the Wamp icon -> php -> extensions, php_imagick should be listed.


Good luck! :)

Medda86
  • 1,582
  • 1
  • 12
  • 19
3

PHP 5.4 php_imagick.dll is here: http://www.peewit.fr/imagick/ . I read somewhere that 64bit php doesnt work with php_imagick. That might be the case when you get this error in apache_error.log

PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' -
%1 is not a valid Win32 application.\r\n in Unknown on line 0

As mentioned above, it was also necessary to add this into httpd.conf (also, i read you cant have spaces/dashes/dots):

SetEnv MAGICK_HOME C:/imagemagick"

If you dont, you might get this error:

"PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' -
The specified procedure could not be found. in Unknown on line 0"

In the end, this article might partially help: http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/

psycho brm
  • 7,494
  • 1
  • 43
  • 42
  • 1
    The above php_imagick.dll worked with version ImageMagick-6.7.7-4-Q16-windows-dll.exe from here: http://mhonarc.veidrodis.com/image_magick/binaries/ . It DID NOT work with 6.8.0 in my case. – psycho brm Nov 20 '12 at 20:49
3

This was a headache for me as well, but unfortunately I installed this quite awhile ago. The instructions from that link you posted seem accurate. Have you ran phpinfo(); to see if it is installed in the Apache Environment? It should be listed as MAGICK_HOME.

Make sure "SetEnv MAGICK_HOME C:/imagemagick" is set at the end of your httpd.conf file. Assuming imagemagick is installed in that directory.

Be sure that you have the extension "php_imagick.dll" in your php.ini file as well.

It should work just fine if you have all those set.

On another note, here is a nice little library someone built to make imagick easier to use. https://github.com/francodacosta/phmagick

I hope that helps! Good luck!

Armali
  • 18,255
  • 14
  • 57
  • 171
Trevor
  • 11,269
  • 2
  • 33
  • 40
  • thanks for you help, I tried adding `SetEnv MAGICK_HOME C:/Program Files/ImageMagick-6.6.6-Q16` to the conf file but it stops apache from working. have tried with both forward and backward slashes... I've updated the question of you have a spare second, – Haroldo Dec 16 '10 at 10:54
  • I recommend installing it in C:/imagemagick. Leave out any dashes and periods. There could be issues with the name of the folder. – Trevor Dec 21 '10 at 01:35
2

I've never used WAMP but I have found that sometimes installing PHP extensions on Windows I need to ensure that any dll's that the extension relies on is in the Windows system PATH. If there is more than the one dll packaged with the imagemagick extension, try adding the directory that the dll's reside in to the Windows system PATH then REBOOT (to ensure that the web server gets a copy of the NEW environment).

Stacey Richards
  • 6,536
  • 7
  • 38
  • 40
  • Thanks Stacey, there are specific dll's for inserting into the PHP extensions folder, but they're found on third party sites and there's tons to choose from... – Haroldo May 31 '10 at 14:02
0

I know this is an old question but i guess this will help someone someday out there....

If you are on WAMPP and have PHP 5.4.x installed , go here http://www.peewit.fr/imagick/

and download appropriate files as instructed. It will work.

Ahsan
  • 459
  • 8
  • 22
  • windows 8.1 and works well with ImageMagick-6.6.3-9-Q16-windows-dll .. remeber run 32 bit install of wamp – Medda86 Aug 17 '14 at 15:51
  • This is a subset of the info already contained in [this](https://stackoverflow.com/a/13449471/5411817) post from a year earlier, and does not add anything new. Please do not post duplicate content, instead Upvote good, useful answers. This ensures SO works as intended, and allows visitors to find quality/useful info quickly. Note that the SO platform is different from forum platforms. – SherylHohman Dec 16 '20 at 18:02
0

Please see this answer already on StackOverflow:

Installing ImageMagick extension with php/windows

I answered this question some time ago. This solves the DLL mismatch error.

Community
  • 1
  • 1
buttercup
  • 1,096
  • 16
  • 37