Keith Davis
Keith Davis

Reputation: 351

PHP fails to load imagick extension (Windows)

I have had zero issues with this in years. Prior to that, we were always having trouble getting php_imagick.dll to load. Suddenly, this process is failing on 2 machines (maybe more, but we know of 2 for sure, both dev machines). Nothing has changed - no updates, no config, nothing, just suddenly, on 2 dev machines it fails. This does not fail on at least 1 other dev machine and our test machine (luckily also not failing in production).

C:\windows\system32>C:\PHP\php.exe -cC:/php/devrc/php.ini -m

Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: ext\imagick (The specified module could not be found.), ext\php_imagick.dll (The specified module could not be found.)) in Unknown on line 0

I have tried everything I can think, and as far as I can tell, these are identical.

I even took a brand new VM. Copied the files from the failing machine (c:\PHP and c:\imagemagick) to that machine. Installed vcredist140. Failed with the same issue. Added c:\imagemagick to the %PATH% variable. Works!

I have verified that c:\imagemagick is in the path and even tried copying the files to c:\PHP, still fails. Something has changed that is affecting 2, and only 2 (so far), machines. All machines are Windows 10 21H1 or Server 2019, the 2 that are failing are Windows 10 21H1.

We are using the 7.4.21 build by Jan E on https://www.apachelounge.com/viewtopic.php?t=6359, including the artifact created for the c:\imagemagick folder. However, I tried https://mlocati.github.io/articles/php-windows-imagick.html as well.

I know they are identical as we put both c:\PHP and c:\imagemagick in a Git repo.

Upvotes: 0

Views: 1052

Answers (1)

cmb
cmb

Reputation: 715

I suggest to use deplister.exe (contained in all binary zips from windows.php.net) to track the dependecies. So call deplister php_imagick.dll; this should list all dependencies, and whether they can be found.

Upvotes: 2

Related Questions