Saturday, February 18, 2012

WAMP Server and ImageMagick

Update 9/5/18 - This is more than likely widely outdated. You're probably better off using XAMP over WAMP.

Edit: If you're running x64 bit version of Windows 7 you will need to install wamp, imagick, and php_imagick.dll ALL as x32 bit.

I decided to write this tutorial because this gave me a massive headache for three hours and I want others to not have to go through what I did.

There's millions of guides about this on the internet, but they all seem to be missing one crucial thing.



The .dll file (which we will get to later) MUST be compiled in VC9, or it will not work with php 5.3.5.

My Guide to Install ImageMagick on WAMP Server:


1. Download ImageMagick for Windows here: http://www.imagemagick.org/script/binary-releases.php?ImageMagick=p7k0tc2pra2nbmrgs423c5gsh6#windows (Select the first one on the list ImageMagick-6.7.5-6-Q16-windows-dll.exe)

2. Install to directory C:\imagemagick


and when prompted with a list of selections, choose everything but "Install PerlMagick for ActiveState Perl v51412.2 build 1402" as it causes the installation to error out.


3. Download the VC9 compiled .dll for windows here: http://valokuva.org/builds/

4. Move the downloaded VC9 compiled .dll to this directory: C:\wamp\bin\php\php5.3.5\ext
       *Note: This is the default install directory, it may be different for you.

5. Open up php.ini in a text editor by navigating to (default) C:\wamp\bin\php\php5.3.5\php.ini or by clicking on the WAMP tray icon and selecting php then php.ini.

6. Now that you are in php.ini and editing it, scroll til you find a list of extensions (see picture)

7. After finding the list, add "extension=php_imagick.dll" (without quotes) to the list, as I did above.
     *Note: Do not put a ";" in front of it as it will be commented out.

8. Unfortunately ImageMagick also has issues working with Apache version 2.2  so you need to downgrade to 2.0.63. Don't worry, it's a lot easier than it sounds.

9. To downgrade to Apache 2.0.63 click on the WAMP tray icon, hover over Apache, then Version, then click "Get more..."


9. You will be directed to the WAMP server website, (it may be in French so you can click the English button  in the upper right corner to change it.)

10. Locate and click on "Download Apache Add Ons".

11. In the window that comes up, click on Apache 2.0.63.

12. You will be redirected to a download page, let it download and install it.

13. Start WAMP server again, click on the tray icon, hover over Apache, then click Apache 2.0.63 (Like the image above)

14. Restart all services within WAMP. (Click on Icon, select restart all services).

15. You should now be able to use ImageMagick with no problem.


Hopes this helps anyone that is having issues. Took me a while to figure it out, but thanks to a friend of mine and going through all the steps over and over again, I finally figured out a way to get it working.

16 comments:

  1. Hey bro, nice post, really helped me a lot, thanks a lot, luv you... :)))))

    ReplyDelete
  2. After reading your tutorial I finally got imagick to show up in phpinfo(). Took me a whole day but I got it. Lt's hope it works now. Not only did I have to downgrade Wampserver to 2.0, I also had to downgrade php to 5.2.1. I used the php_imagick_dyn-Q16.dll found here: http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/ Thanks for the great tutorial! For the record to, I have Win7 64 bit version installed.

    ReplyDelete
  3. No problem guys. This gave me such a headache I had to let others see how to do it.

    @Dennis, I'm surprised you were able to get this method to work on Win 7 x64. I tried to do it myself, and was unable to. Maybe I will try downgrading php as well.

    ReplyDelete
  4. Hi there,

    is http://valokuva.org/ down?

    ReplyDelete
    Replies
    1. hm... appears online to me. By the way, this is a good tool to use for checking if websites are online or not: http://www.downforeveryoneorjustme.com/

      Delete
  5. @Alex Yes, it was working beautifully until today. My hosting provider finally upgraded to 5.3 and I am finally to use late static binding (not available in 5.2. The problem is, the extension shows up in wampserver but I can't get imagick to show up in phpinfo(). Have you had any success runningit on win7 64 bit with 5.3?

    ReplyDelete
  6. 2011-04-25 18:49 - php_imagick_ts.dll

    ImageMagick-6.7.6-0-Q16-windows-dll

    Worked on my Win7 x64 with WAMPSERVER (32 BITS & PHP 5.3) 2.2E

    What a pain in the butt

    ReplyDelete
    Replies
    1. Oh you were able to get it to work? Awesome. I actually stopped using WAMP server and installed Debain linux on a 10 year old pentium 2 PC haha. I'm really surprised it worked, but it runs like a champ and is excellent for a local web server! If you have any old box, I would recommend this. Especially if you already have experience with linux.

      Delete
  7. Yes, finally after struggling for another 5 hours I finally tried enough combinations of dll files and got it working. Great idea about converting an old box. I thought of doing that myself.

    ReplyDelete
  8. Hey !!!

    i followed all the steps but though i didnt get imagic in my wamp :(

    ReplyDelete
  9. you tutorial is awesome and i have now no installing errors but actually i still got that error on testing
    Fatal error: Class 'Imagick' not found in D:\wamp\www\cropzoom-master\test\resize_and_crop_imagick.php on line 18

    please help :(

    ReplyDelete
  10. I tried to do as you had mentioned but I always get :Fatal error: Class 'Imagick' not found. Any idea? how can i solve this problem

    ReplyDelete
  11. Hey guys. I noticed that this is now outdated, and I tried to get it working again so I could update the post, but success on this was very limited. I was able to get imagick working, but it was returning an error whenever I would open WAMP. If I do find some other solution, I'l update the post.

    ReplyDelete