Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load imagick library

I have installed the imagick from here (ImageMagick-7.0.3-1-Q16-x64-dll) and the dll (TS 32 bit) from here. And also copiend the CORE_RL_* to the C:\xampp\apache\bin BUT still i get the following error when i run the laravel server.

ERROR: Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found. in Unknown on line 0

Also, I placed dll file in C:\xampp\php\ext\php_imagick.dll.

Also, the imagick is shown in the phpinfo(). enter image description here

And when i use it using laravel i get the following error. enter image description here

like image 263
Jamal Abdul Nasir Avatar asked Sep 21 '16 07:09

Jamal Abdul Nasir


1 Answers

getting Imagick to work on windows has always been a bit hit and miss as pointed out here is a good guide http://stackoverflow.com/a/36378764/1090867

But it misses an important point

You do not need to put the binary into the PHP folder!

So here are the steps I follow myself everytime I need to do this. This should work for apache, nginx or IIS.

Step 1

find out your php version and setting

enter image description here

You need to version, Architecture, Compiler and Thread Safety

if Thread Safety is disabled this is NTS is enabled it will TS

Step 2

Get an install a copy of imageMagick it just make sure it matches your Architecture, this also needs to be dll.exe rather that the static version.

Regarding Q8 and Q16 I'll leave that to you but both versions will work

Link

I recommend changing the install directory name to something geneeric like C:\Imagemagick since I've had some problems in the past with te default directory name with PHP and windows.

Just install but make sure you tick add application path and I normally tick the legacy utils as well.

enter image description here

Once its install go to your environment variables and make sure it is actually in the path. There is no need to copy anything to your php folder

Just to make sure everything is working open the command line and type convert --version you should get a reponse

Step 3

This unfortantly is the hard part and can be a bit of trial and error. I've found the following provides the best php_imagick.dll that seems to work 9 times out of 10

http://www.peewit.fr/imagick/

Just pick the version that matches your install.

If this doesn't work then go to php.net and try each version until one works... (start at the latest)

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

Once you have a php_imagick.dll put it into your php/ext/ folder

thne locate your php.ini file go to the bottom (or whereever your extensions are) and add extension=php_imagick.dll

Step 4

Restart PHP (or your computer) and it should be working if not try a different php_imagick.dll and repeat.

If the above doesn't work

Then try a slightly older version of imagick I normally use version 6.8.6-8 Q16.

Please note I've only every really done this on Windows 7 and Windows Server 2008, 2008 R2, 2012 and 2012 R2 all x64 with x86 php

If this still doesn't work then you probably need to copy over the CORE_RL files into your imagick directory this normally causes more issues but if you are running out idea then give it a go

like image 173
Avenyet Avatar answered Oct 06 '22 01:10

Avenyet