Closed tmb-github closed 5 years ago
Exactly same thing happening
It's telling you which files it's trying to load:
tried: C:\xampp\php\ext\imagick (The specified module could not be found.), C:\xampp\php\ext\php_imagick.dll (The specified procedure could not be found.)
So it's trying the wrong file first and then allegedly the correct file.
I do have the file in the right location for XAMMP (C:\xampp\php\ext).
With the older form it trying:
tried: C:\xampp\php\ext\php_imagick.dll (The specified module could not be found.), C:\xampp\php\ext\php_php_imagick.dll.dll
It's trying the correct filename first, and then the wrong file name.
I'm pretty sure this will either be a permissions issue, or some other issue local to your machine, rather than something caused by the change in dll loading.
No, I've used php_imagick.dll in every version of PHP in XAMPP for Windows since PHP 5.6, and it's worked consistently. I've never had this problem before. It worked on PHP 7.1.X without any issue. There are no permission conflicts or restrictions.
To prove this, I performed a little test:
One of the standard PHP extensions is php_bz2.dll. In my PHP.INI file, it's referenced like this:
extension=bz2
There are no error messages in the PHP error log file for it. So I changed the PHP.INI line to this:
extension=bz2XXX
...and put the php_imagick.dll declaration below it, like this:
extension=bz2XXX
extension=imagick
The result is the same error message as for imagick...here's the log file:
[12-Jan-2018 14:48:12 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'bz2XXX' (tried: C:\xampp\php\ext\bz2XXX (The specified module could not be found. ), C:\xampp\php\ext\php_bz2XXX.dll (The specified module could not be found. )) in Unknown on line 0
[12-Jan-2018 14:48:12 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: C:\xampp\php\ext\imagick (The specified module could not be found. ), C:\xampp\php\ext\php_imagick.dll (The specified procedure could not be found. )) in Unknown on line 0
Then I removed the "XXX" from the end of the bz2 extension declaration in the PHP.INI file, like this:
extension=bz2
extension=imagick
...and the log file only shows that imagick cannot be loaded; php_bz2.dll is loaded just fine:
[12-Jan-2018 14:52:00 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: C:\xampp\php\ext\imagick (The specified module could not be found. ), C:\xampp\php\ext\php_imagick.dll (The specified procedure could not be found. )) in Unknown on line 0
Both php_bz2.dll and php_imagick.dll are in the very same folder.
So...what's going on? Something's wrong with php_imagick.dll and the PHP 7.2.X distributions (the problem exists for 7.2.0 and 7.2.1).
(Also notice that the user "narian" above has experienced the same problem.)
@Danack Can your provide versions of ImageMagick and php_imagick that works with PHP7.2 on Windows? Because I think, it's only a Windows (or latest xampp) issue, I've tried to run imagick on Debian 9 on PHP7.2 and it works perfectly. Thanks!
I confirm this issue on Windows with current releases with PHP 7.2.0+
Confirm the issue as well. And I wanted to move to it from GD =(
I also confirm this issue on Windows with PHP 7.2.x
Update: got it to work with this snapshot http://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/ using only the php_imagick.dll from the archive and Imagick 7.0.7-22
Strange, I tried that as well, but did not work for me. I am now using 7.2.2 from https://www.apachelounge.com/viewtopic.php?t=6359 and what fixed this for me is using ImageMagick ImageMagick 6.9.9-30 Q16 x64
I confirm that the snapshot version for PHP 7.2 is working. When should we expect an official stable release?
Hi,
the snapshot as linked is #219 requires ImageMagick 7.x as provided under http://windows.php.net/downloads/pecl/deps/ . It might be ok with a subsequent ImageMagick 7.x series, though tested and linked with the exact 7.0.7-11 as under the link. Note also, I've no idea how the official ImageMagick releases are built. The compiler has to match, thus for PHP 7.2 it's vc15. Please also use the official windows.php.net binaries for the tests.
For PHP 7.2, the intention was to use ImageMagick 7 having improvements and better security, for the imagick builds targeting lower PHP version, ImageMagick 6 still supporting security but being legacy as provided in the deps link has to be used. Be sure the corresponding DLLs are preceding any others on the %PATH%
.
To mention, the bug https://bugs.php.net/bug.php?id=75890 has nothing to do with imagick, but is a codepage issue.
Thanks.
Note also, I've no idea how the official ImageMagick releases are built. The compiler has to match, thus for PHP 7.2 it's vc15.
The official ImageMagick 6.x and 7.x releases have DLL's that call MSVCR120.dll, so they are all built with VC12. Ergo, the compilers do not match with any PHP version. You are lucky if it works, but don't be surprised if you get issues when you are mixing VC runtimes.
If anybody really wants to build php_imagick.dll for PHP 7.2 with ImageMagick 7.x, the following is needed:
The official ImageMagick releases are apparently built using Appveyor. See https://github.com/ImageMagick/ImageMagick-Windows/blob/master/appveyor.yml which confirms that they are using Visual Studio 2013 aka VC12.
Thanks for checking, @Jan-E. Ditto.
Thanks.
Throwing my confirmation into the ring:
Apache 2.4,29/PHP7.2.2 on a Win7 machine (VC14 ThreadSafe).
php_imagick-3.4.3-7.1-ts-vc14-x64 --> No Joy php_imagick-3.4.3-7.2-ts-vc15-x64 --> SheBang! :o)
I dunno if the vc15 is 100% accurate but I do NOT have the vc15 redistributable installed (only vc14/vs2015). Also. I got phpinfo-imagick to confirm working and then used a few web pages we have, but did not check every nook & cranny.
Thank you odysseuscm!
Where did you find php_imagick-3.4.3-7.2-ts-vc15-x64?
It's not in the list on this date: https://pecl.php.net/package/imagick (https://pecl.php.net/package/imagick/3.4.3/windows)
For those of you like me who have never installed ImageMagick on Windows with PHP, let alone for PHP 7.2, I found this article very useful: Install the ImageMagick PHP extension in Windows
The table here only goes up to PHP 7.1, so I also confirm that using these builds worked for me on PHP 7.2.2/Windows 10 (thread-safe version):
The workflow seems really clunky to me, but I did exactly as instructed:
CORE_RL_
IM_MOD_RL_
extension=imagick
And then to run a simple test (should output a 1):
php -r "print(class_exists('imagick'));"
If anyone knows a more elegant installation solution, please let me know šø
Newer ImageMagick-6.9 binaries can be found here: https://ci.appveyor.com/project/Jan-E/imagemagick-windows/build/ImageMagick-ImageMagick-Windows-6-VS2017.62 Check the artefacts of each job to download the binaries. @weltling The VC14 artefacts are similar like the ones at http://windows.php.net/downloads/pecl/deps/ Maybe it is time to use Appveyor to build the deps.
For the others: all my PHP builds at https://www.apachelounge.com/viewtopic.php?t=6359 are built with ImageMagick 6.9.9-35 Q16 x64 2018-02-02
@weltling The VC14 artefacts are similar like the ones at http://windows.php.net/downloads/pecl/deps/
@weltling I changed the artefact filenames into names like ImageMagick-6.9.9-35-vc15-x86.zip and added the LICENSE: https://ci.appveyor.com/project/Jan-E/imagemagick-windows/build/ImageMagick-ImageMagick-Windows-6-VS2017.106
There is a huge ffmpeg.exe in the bin directory, which makes the zipfile bigger than strictly necessary.
Following the tips provided earlier in the thread, I succeeded in getting imagick to load in PHP 7.2 on my Windows XAMPP when I went here:
https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/
...and downloaded & installed this x86 "snapshot" file set:
11/23/2017 4:51 PM 9072708 php_imagick-3.4.3-7.2-ts-vc15-x86.zip
...on top of the current 3.4.3 set at https://pecl.php.net/package/imagick (thus, overwriting some of its files).
I hope whoever is maintaining the pecl repos will update the DLLs accordingly. Thanks for everyone who posted and help solve this problem for me. I hope it will help others solve similar problems.
After 3 hours of installing, un-installing and re-installing I was finally able to make it work. Basically, it's important to check your phpinfo() for your architecture and compiler versions: mine was x86 and MSVC15.
Based on this you want to head to imagemagick and download the appropriate executable ImageMagick-7.0.7-28-Q16-x86-dll.exe
After installing run "magick -version" in the command prompt to verify installation. You should see version information.
Then head here and download php_imagick-3.4.3-7.2-ts-vc15-x86.zip . Unzip and copy the php_imagick.dll to the path c:\xampp\php\ext
Edit php.ini and add the following line under Dynamic Extensions where the other extensions are loaded extension=php_imagick.dll
Head here and download ImageMagick-7.0.7-11-vc15-x86.zip . Unzip and copy all files with prefixes CORE_ and IMMOD , and add them to c:\xampp\apache\bin. Also add c:\xampp\apache\bin to your .
You will need to add the bin directory of Apache (C:\xampp\apache\bin) to the PATH environment variable of Windows.
Anyone dealing with this problem on osx? I am running 10.13.3 with php 7.2.4 and can't get it to work anymore :(
The table here only goes up to PHP 7.1
I updated my imagick install instructions: it now includes instructions about how to install ImageMagick on Windows with PHP 7.2
If anyone knows a more elegant installation solution, please let me know
@chfabbro If you don't want all those DLL files in your PHP directory, you can have them in any directory in your PATH (from my article: "or to a directory present in your PATH environment variable")
@mlocati Your page is very helpful, thank you! I can try your suggestion of placing the files in a location accessible to the Windows PATH.
I just released a PowerShell module that makes very easy to setup the imagick PHP extension (well, every PHP extension :wink:): https://github.com/mlocati/powershell-phpmanager
Thanks @odysseuscm it works \o/
@mlocati solution is as cool as possible š Now upgrades are very quick and easy and installing extensions, too. Thank you very much.
Still not working: http://prntscr.com/jx6ara
PHP: 7.1.16 TS: Enabled x86
@LG0012 I just tried to install imagick both on PHP 7.1 and 7.2 (thread-safe, x86), without any problems:
PS C:\test> Install-Php -Version 7.2 -Architecture x86 -ThreadSafe $true -Path C:\test\7.2 -TimeZone Europe/Rome -InitialPhpIni Development
PS C:\test> Install-PhpExtension -Extension imagick -MinimumStability snapshot -Path C:\test\7.2
PS C:\test> C:\test\7.2\php.exe -r '$image = new Imagick(); $image->newImage(1, 1, new ImagickPixel(\"#ffffff\")); $image->setImageFormat(\"png\"); $pngData = $image->getImagesBlob(); echo strpos($pngData, \"\x89PNG\r\n\x1a\n\") === 0 ? \"Ok\" : \"Failed\";'
Ok
PS C:\test> Install-Php -Version 7.1 -Architecture x86 -ThreadSafe $true -Path C:\test\7.1 -TimeZone Europe/Rome -InitialPhpIni Development
PS C:\test> Install-PhpExtension -Extension imagick -Path C:\test\7.1
PS C:\test> C:\test\7.1\php.exe -r '$image = new Imagick(); $image->newImage(1, 1, new ImagickPixel(\"#ffffff\")); $image->setImageFormat(\"png\"); $pngData = $image->getImagesBlob(); echo strpos($pngData, \"\x89PNG\r\n\x1a\n\") === 0 ? \"Ok\" : \"Failed\";'
Ok
PS:
PS C:\test> Get-Php -Path C:\test\7.2
Folder : C:\test\7.2
ExecutablePath : C:\test\7.2\php.exe
ExtensionsPath : C:\test\7.2\ext
Version : 7.2.7
RC :
FullVersion : 7.2.7
DisplayName : PHP 7.2.7 x86 (32-bit) Thread-Safe
Architecture : x86
ThreadSafe : True
VCVersion : 15
PS C:\test> Get-PhpExtension -Path C:\test\7.2 | Where-Object { $_.Name -eq 'imagick' }
Type : Php
State : Enabled
Name : imagick
Handle : imagick
Version : @PACKAGE_VERSION@
Filename : C:\test\7.2\ext\php_imagick.dll
PS C:\test> Get-Php -Path C:\test\7.1
Folder : C:\test\7.1
ExecutablePath : C:\test\7.1\php.exe
ExtensionsPath : C:\test\7.1\ext
Version : 7.1.18
RC :
FullVersion : 7.1.18
DisplayName : PHP 7.1.18 x86 (32-bit) Thread-Safe
Architecture : x86
ThreadSafe : True
VCVersion : 14
PS C:\test> Get-PhpExtension -Path C:\test\7.1 | Where-Object { $_.Name -eq 'imagick' }
Type : Php
State : Enabled
Name : imagick
Handle : imagick
Version : 3.4.3
Filename : C:\test\7.1\ext\php_imagick.dll
Then I have no idea what its going on. We are using Xampp right now, maybe because of that?
Ok, so your php version is different, I will try to update that.
I don't think that the problem is the PHP version (and I don't know what's going wrong for you):
PS C:\test> Install-Php -Version 7.1.16 -Architecture x86 -ThreadSafe $true -Path C:\test\7.1.16 -TimeZone Europe/Rome -InitialPhpIni Development
PS C:\test> Install-PhpExtension -Extension imagick -Path C:\test\7.1.16
PS C:\test> C:\test\7.1.16\php.exe -r '$image = new Imagick(); $image->newImage(1, 1, new ImagickPixel(\"#ffffff\")); $image->setImageFormat(\"png\"); $pngData = $image->getImagesBlob(); echo strpos($pngData, \"\x89PNG\r\n\x1a\n\") === 0 ? \"Ok\" : \"Failed\";'
Ok
We are using this package in our laravel project - "bacon/bacon-qr-code". Maybe something wrong with that one, I will take a look at this, and will came back with the response.
"The specified module could not be found" is often a sign that a dependency of the module is missing. Make sure, that at least the correct (x86/x64, vc-version) core_rlwand.dll and core_rlmagick.dll are first in the path or in the directory with php.exe.
Inside ImageMagick zip folder, I see 3 folders: bin, include, lib.
Regarding the guides, everybody is saying that - from ImageMagick zip folder you only have to copy all core_rl and im_mod_rl files into apache/bin folder. Thats what I did and the question is, what about other folders or files?
Make sure, that at least the correct (x86/x64, vc-version) core_rlwand.dll and core_rlmagick.dll are first in the path or in the directory with php.exe.
There are more dll used by the imagick extension:
@LG0012 try following my imagick install instructions (or use my PhpManager powershell module - like I did in the above examples of mine).
@LG0012
Regarding the guides, everybody is saying that - from ImageMagick zip folder you only have to copy all core_rl and im_mod_rl files into apache/bin folder.
Chances are high that PHP cannot find the dll's in the apache/bin folder. A better place is the php folder.
@mlocati
There are more dll used by the imagick extension
I am very well aware of that, because I am building ImageMagick 6 on AppVeyor myself for Visual Studio 2015 and 2017: https://github.com/Jan-E/ImageMagick-Windows/branches
ImageMagick is smart enough to look for and find the IM*.dll's in C:\Program Files\ImageMagick\modules\coders
(x64) or C:\Program Files (x86)\ImageMagick\modules\coders
(x86), even if those folders are not in your path. So the IM*.dll files do not have to be in the PHP folder if you have ImageMagick x86 and x64 installed on your system.
With https://github.com/mlocati/powershell-phpmanager you can do everything with just this powershell command:
Install-PhpExtension imagick -MinimumStability snapshot
This thread has been inactive for some time, however...
The Imagick extension recently ceased loading on my copy of XAMPP, yet I had not changed anything in my XAMPP setup, and the error messages were exactly the same as the ones I originally had had when I started this thread. Eventually I discovered the problem: I had deleted the Visual C++ Redistributable for Visual Studio 2015 from my system since the last time I had used Imagick in a PHP project. Reinstalling it fixed the problem. So, at least in my case, having the VC redistributable installed is essential to the solution.
I got same thing,
When I check phpinfo() in browser, Imagick shown bit in terminal, I just run php -v
and got error
This is in browser:
imagick module | enabled
-- | --
imagick module version | 3.4.3
imagick classes | Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version | ImageMagick 6.9.3-7 Q16 x86 2016-03-27 http://www.imagemagick.org
Imagick using ImageMagick library version | ImageMagick 6.9.3-7 Q16 x86 2016-03-27 http://www.imagemagick.org
ImageMagick copyright | Copyright (C) 1999-2015 ImageMagick Studio LLC
ImageMagick release date | 2016-03-27
ImageMagick number of supported formats: | 0
ImageMagick supported formats | no value
This is result in command line
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp7.1\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp7.1\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
PHP 7.1.24 (cli) (built: Nov 8 2018 05:28:30) ( ZTS MSVC14 (Visual C++ 2015) x86 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
Im sure I push php_imagick.dll in ext/
.
Any help?
@abinhho it's not enough to have the php_imagick.dll
file (this is the imagick
PHP extension): you also need the ImageMagick
DLL files.
To install them, see https://mlocati.github.io/articles/php-windows-imagick.html (or https://github.com/mlocati/powershell-phpmanager)
@mlocati
I also installed both ImageMagick
and php_imagick.dll
but it's not right version. After used your ways, It's worked for me.
Many thanks !!! š„
@mlocati very useful. Will you be updating for PHP 7.3 now out as stable?
@weltling must be able to trigger snapshot builds for PHP 7.3
Any reason why there's only a snapshot build of imagick.dll for PHP 7.2?
In PHP 7.2, the extensions definitions in the php.ini file do not require the initial "php_" nor the extension ".dll". So, for the php_imagick.dll file to be specified as an extension in the php.ini file, in theory you only need to add:
extension=imagick
Not:
extension=php_imagick.dll
...although, for backward compatibility, the instructions at the top of the file indicate that the older, full-name specification will still work but will be deprecated at some point.
Using either form above does not work. When using the new form (
extension=imagick
) and when I start my XAMPP Apache server, I receive this error:Using the older form of the extension initialization, (
extension=php_imagick.dll
), the error message becomes:I do have the file in the right location for XAMMP (C:\xampp\php\ext).
Can anyone else reproduce this error and/or provide a solution? I can't use PHP 7.2 until this is solved (imagick works in PHP 7.1).