Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: php_imagick problems (Windows, php 7.4.21) |
Page Previous 1, 2 |
Author |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Wed 28 Jul '21 19:04 Post subject: |
|
|
laurin1 wrote: | 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. | Bummer.
What I noticed when running the official ImageMagick installer (saved at https://phpdev.toolsforresearch.com/ImageMagick-7.1.0-2-Q16-x86-dll.exe ) is that the installer did put some extra dll's in the install directory. Looks like dll's from the redistributable. Try running the installer with c:\imagemagick as install directory and run 'php-cgi -i' with
Code: | path=C:\PHP;c:\imagemagick |
FYI: the phpinfo dumps in my builds are always generated with almost nothing in the environment and
|
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Fri 30 Jul '21 19:32 Post subject: |
|
|
Now this makes no sense. Suddenly, both machines that were failing to load the extension are not anymore, but now all of our dev machines (thankfully this has not hit test or prod), are failing like this:
RegistryKeyLookupFailed `CoderModulesPath' @ error/module.c/GetMagickModulePath/665 |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Sun 01 Aug '21 20:02 Post subject: |
|
|
laurin1 wrote: | RegistryKeyLookupFailed `CoderModulesPath' @ error/module.c/GetMagickModulePath/665 |
OK, that gave me the clue. ImageMagick is looking for a key CoderModulesPath. If you run the installer these keys are added to the registry:
Code: | [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\7.1.0\Q:16]
"BinPath"="C:\\Program Files\\ImageMagick"
"ConfigurePath"="C:\\Program Files\\ImageMagick"
"LibPath"="C:\\Program Files\\ImageMagick"
"CoderModulesPath"="C:\\Program Files\\ImageMagick\\modules\\coders"
"FilterModulesPath"="C:\\Program Files\\ImageMagick\\modules\\filters" | If it does not find the CoderModulesPath registry key CORE_RL_MagickCore_.dll throws an error. See https://github.com/ImageMagick/ImageMagick/
blob/2747ccfc1044fc3da6d32ff1ebbca5e926fcf602/MagickCore/
module.c#L663-L668: Code: | if (key_value == (unsigned char *) NULL)
{
ThrowMagickException(exception,GetMagickModule(),
ConfigureError,
"RegistryKeyLookupFailed","`%s'",registery_key);
return(MagickFalse);
} | This piece of the code is only compiled into CORE_RL_MagickCore_.dll if ImageMagick's configure.exe was run with an argument /installedSupport. Without /installedSupport this whole block of code is excluded: https://github.com/ImageMagick/ImageMagick/blob/
2747ccfc1044fc3da6d32ff1ebbca5e926fcf602/MagickCore/
module.c#L602-L684:
Code: | #if defined(MAGICKCORE_INSTALLED_SUPPORT)
...
#endif |
So, my first idea was to compile the DLL's without /installedSupport. This effectively removed the fatal error inside CORE_RL_MagickCore_.dll, but also resulted in php_imagick.dll not finding the 263 supported formats. Not ideal.
So the second approach was to patch ImageMagick and let it gracefully handle the situation when a registry key is not found: Code: | if (key_value == (unsigned char *) NULL)
{
return(MagickFalse);
} | For humans: return 'module not found' when the registry key is not there. The following link points to the patch in my build script:
https://github.com/Jan-E/ImageMagick-Windows/commit/e84d9f7729ebdcda1a28827f6566a4e2fb719413
@laurin1: could you test my php_imagick.dll (7.4.22 by now) with the dll's in the zip at
https://ci.appveyor.com/project/Jan-E/imagemagick-windows/builds/40203793/job/aom1wh7vgho2tfed/artifacts (x86) or at
https://ci.appveyor.com/project/Jan-E/imagemagick-windows/builds/40203793/job/l3kegl1coow9vsxw/artifacts (x64).
Be sure to remove all registry keys at HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick.
If this works OK, I will create a pull request for the ImageMagick devs. |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Mon 02 Aug '21 13:26 Post subject: |
|
|
Ok, but this still does not make sense.
We discovered long ago that as long as all the DLL's are in one folder (c:\ImageMagick for us) and that folder is in the PATH variable, then those keys are not necessary...except on Windows Server 2008 R2, which (and try not to freak out), is what our 2 internal production servers are running (2008 Web Server R2). On all the Windows 10 machines, just the PATH variable is all that is needed. For some reason, on 2 machines, this stopped working completely (extension would not load) and then started again. But then on all machines, the version of your that I was using started giving the CoderModulesPath error, which was only resolved by switching the mlocati version, again, no idea why, as this has worked perfectly until recently and we both PHP and Image Magick in Git, so we know nothing has changed.
Anyway, I'll try to test yours in the next day or so. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 02 Aug '21 13:38 Post subject: |
|
|
laurin,
that can make sense, if some paths are hard compiled into the code. |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Mon 02 Aug '21 13:44 Post subject: |
|
|
James Blond wrote: | laurin,
that can make sense, if some paths are hard compiled into the code. |
I'm not sure what you mean. I agree that Jan's conclusions are correct, but the problem is that without all that, it did work. We've been on the a version Jan compiled for months without issue, and then suddenly it did not work - not just that, first it failed one way on 2 machines only, then it failed another way on all machines.
Just to be clear, when this as failing for me neither issue was solved by either the PATH variable or the registry keys he indicated. I tried BOTH of those methods - the extension not loading was resolved on it's own somehow, the CoderModulesPath was not resolved by either the PATH or other registry keys (like we have to do with Server 2008), only mlocati solved these issues. Why did Jan's work for so long and then failed? In my mind this has to be environmental, some Windows update or something along those lines. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Mon 02 Aug '21 13:46 Post subject: |
|
|
James Blond wrote: | laurin,
that can make sense, if some paths are hard compiled into the code. | They are not hardcoded in the code. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Mon 02 Aug '21 14:49 Post subject: |
|
|
On the machines that still work, do you get to see the supported formats? Or something like
https://imgur.com/a/c2gSEwR
And in the mlocati version: with or without the supported formats? |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Mon 02 Aug '21 18:30 Post subject: |
|
|
Jan-E wrote: | On the machines that still work, do you get to see the supported formats? Or something like
https://imgur.com/a/c2gSEwR
And in the mlocati version: with or without the supported formats? |
238 supported formats:
3FR, 3G2, 3GP, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CLIPBOARD, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPS, DPX, DXT1, DXT5, EMF, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FLIF, FPX, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBP, WMF, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YCbCr, YCbCrA, YUV |
|
Back to top |
|
laurin1
Joined: 26 Oct 2014 Posts: 74 Location: Flower Mound, TX
|
Posted: Mon 02 Aug '21 20:18 Post subject: |
|
|
Nope. Extension loads, but formats are missing. |
|
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: Tue 03 Aug '21 14:01 Post subject: |
|
|
Those are x86 files, but I am using x64 PHP. |
|
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 |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
|
Back to top |
|
|
|
|
|
|