Author |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Fri 23 Jul '21 0:38 Post subject: php_imagick problems (Windows, php 7.4.21) |
|
|
I have had zero issues with this in years. Prior to that, we were always having trouble getting this to work. Suddenly, this 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. Using the php_imagick.dll and artificat that Jan E creates.
Help! |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sat 24 Jul '21 1:38 Post subject: |
|
|
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. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Sat 24 Jul '21 2:34 Post subject: |
|
|
Could it be that you have or once had used the ImageMagick installer on the failing machines? What happens if you do run the installer? Assuming you are still using the x86 version run that one and use “C:\Program Files (x86)\ImageMagick” as install directory, without adding that directory to the %PATH%. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Sat 24 Jul '21 2:54 Post subject: |
|
|
BTW. The ImageMagick artifacts are VS16 now. Make sure you install the latest vsredist, linked in the downloads section of this forum. For x86 that is https://aka.ms/vs/16/release/VC_redist.x86.exe |
|
Back to top |
|
nono303
Joined: 20 Dec 2016 Posts: 205 Location: Lille, FR, EU
|
Posted: Sat 24 Jul '21 11:16 Post subject: |
|
|
Hi,
You can check arch & compiler version of both imagemagick and php (dll,exe) with this command:
Code: | dumpbin.exe /headers [filetocheck] | grep 'linker\|machine' |
if all are built with vs16, linker version must be 14.2x
...and all arch must be one of x86 or x64
output like:
Code: | C:\sdk\softs\vs22\Community\VC\Tools\MSVC\14.30.30401\bin\Hostx64\x64\dumpbin.exe /headers .\php_imagick.dll | grep 'linker\|machine'
8664 machine (x64)
14.29 linker version |
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sat 24 Jul '21 14:10 Post subject: |
|
|
I'll try that, but I don't know how that could be the problem. We've made no changes to these in a while, 2 machines with these same exact files (I know they are the same as we put both c:\PHP and c:\imagemagick in in a Git repo, 2 still work (well, many more than that, but I can confirm 2), and 2 now fail. I've copied these files to a brand new VM, as long as c:\imagemagick is in the PATH, these same files work. |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sat 24 Jul '21 14:22 Post subject: |
|
|
Both php.exe and php_imagick.dll are:
8664
14.16 |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sat 24 Jul '21 21:43 Post subject: |
|
|
Thanks for doing that. Not sure what that shows us. Like I said, the files that I am using work fine on most machines, but suddenly do not work on 2 machines. I really think the issue is environmental - some supporting files are different. |
|
Back to top |
|
nono303
Joined: 20 Dec 2016 Posts: 205 Location: Lille, FR, EU
|
Posted: Sat 24 Jul '21 23:39 Post subject: |
|
|
laurin1 wrote: | Thanks for doing that. Not sure what that shows us. Like I said, the files that I am using work fine on most machines, but suddenly do not work on 2 machines. I really think the issue is environmental - some supporting files are different. |
If problem only occurs on some VM with same files, try to look the dependencies tree (ex. https://github.com/lucasg/Dependencies) of php_imagick.dll on each VM and you might find some differences |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sat 24 Jul '21 23:48 Post subject: |
|
|
Already tried that as well:
C:\PHP>deplister.exe ext\php_imagick.dll
php7.dll,OK
CORE_RL_MagickWand_.dll,OK
CORE_RL_MagickCore_.dll,OK
KERNEL32.dll,OK
VCRUNTIME140.dll,OK
api-ms-win-crt-heap-l1-1-0.dll,OK
api-ms-win-crt-string-l1-1-0.dll,OK
api-ms-win-crt-math-l1-1-0.dll,OK
api-ms-win-crt-runtime-l1-1-0.dll,OK
api-ms-win-crt-convert-l1-1-0.dll,OK
api-ms-win-crt-stdio-l1-1-0.dll,OK
api-ms-win-crt-locale-l1-1-0.dll,OK |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sun 25 Jul '21 0:11 Post subject: |
|
|
nono303 wrote: | laurin1 wrote: | Thanks for doing that. Not sure what that shows us. Like I said, the files that I am using work fine on most machines, but suddenly do not work on 2 machines. I really think the issue is environmental - some supporting files are different. |
If problem only occurs on some VM with same files, try to look the dependencies tree (ex. https://github.com/lucasg/Dependencies) of php_imagick.dll on each VM and you might find some differences |
Ok, tried that dependency walker, and as far as I can tell, the results are identical for both machines that fail and those that don't. |
|
Back to top |
|
nono303
Joined: 20 Dec 2016 Posts: 205 Location: Lille, FR, EU
|
Posted: Sun 25 Jul '21 9:26 Post subject: |
|
|
laurin1 wrote: |
Ok, tried that dependency walker, and as far as I can tell, the results are identical for both machines that fail and those that don't. |
I suppose that you don't have any useful information in event log or dump in WER\ReportQueue to be analyzed?
Can you launch with procdump on failing VM like this?
Code: | procdump -e 1 -x C:\dumps "C:\php\php.exe" -m |
It might create a dumpfile of the raised exception in C:\dumps that can be analyzed in a debugger |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Sun 25 Jul '21 13:25 Post subject: |
|
|
Nope.
C:\windows\system32>procdump -e 1 -x C:\temp "C:\php\php.exe" -cC:/php/devrc/php.ini -m
ProcDump v10.0 - Sysinternals process dump utility
Copyright (C) 2009-2020 Mark Russinovich and Andrew Richards
Sysinternals - www.sysinternals.com
Process: php.exe (1660)
CPU threshold: n/a
Performance counter: n/a
Commit threshold: n/a
Threshold seconds: n/a
Hung window check: Disabled
Log debug strings: Disabled
Exception monitor: First Chance+Unhandled
Exception filter: [Includes]
*
[Excludes]
Terminate monitor: Disabled
Cloning type: Disabled
Concurrent limit: n/a
Avoid outage: n/a
Number of dumps: 1
Dump folder: C:\temp\
Dump filename/mask: PROCESSNAME_YYMMDD_HHMMSS
Queue to WER: Disabled
Kill after dump: Disabled
Press Ctrl-C to end monitoring without terminating the process.
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
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
imap
json
ldap
libxml
mbstring
memcache
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
Phar
readline
Reflection
session
SimpleXML
soap
SPL
sqlsrv
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
[06:25:09] The process has exited.
[06:25:09] Dump count not reached. |
|
Back to top |
|
puertoblack2003
Joined: 31 Jul 2009 Posts: 121 Location: U.S
|
Posted: Mon 26 Jul '21 15:30 Post subject: |
|
|
currently on php 7.4.21 and updated imagick to 7.1.0-2 Q16 x64
https://imgur.com/a/c2gSEwR
maybe you have a bad batch? |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Mon 26 Jul '21 15:39 Post subject: |
|
|
I'm using the exact same files on every machine - I know because both c:\imagemagick and c:\PHP are in Git repos. These have worked for years, but now those same files don't work on 2 machines. I even copied the files from a failing machine to a VM, these work fine on the VM. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Mon 26 Jul '21 16:34 Post subject: |
|
|
Are there other core_*.dll’s and/or im_*.dll’s on the failing systems, in the path or outside of the path? |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Mon 26 Jul '21 20:56 Post subject: |
|
|
Jan-E wrote: | Are there other core_*.dll’s and/or im_*.dll’s on the failing systems, in the path or outside of the path? |
No. I've scanned the whole system, thinking the same thing, but nothing. |
|
Back to top |
|