imagemagick version mismatch
shivammathur opened this issue · comments
For PHP 7.4 and lower after the release of imagick 3.6.0RC1, ImageMagick was updated, so it gives the version mismatch warning
PHP Warning: Version warning: Imagick was compiled against ImageMagick version 1799 but version 1808 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
While this is a warning, it breaks PhpManager installing any extensions specified after imagick
.
Test workflow: https://github.com/shivammathur/test-setup-php/actions/runs/1447619348/workflow
This can be fixed temporarily by changing the $pageUrl
in Install-ImagickPrerequisite.ps1
to archives, but when imagick
3.6.0 releases it would break again as the change will have to be reverted, as that will use newer ImageMagick.
Also, I noticed now the ImageMagick DLLs are inside the extension zip for versions lower than PHP 8.0, so maybe using those instead of downloading the library might help.
I checked the ImageMagick versions used to build the different imagick versions:
Imagick \ PHP | 5.3 | 5.4 | 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 | 7.4 | 8.0 |
---|---|---|---|---|---|---|---|---|---|---|
3.1.2 | 6.8.8-4 Q16 | 6.8.8-4 Q16 | 6.8.8-4 Q16 | 6.8.8-4 Q16 | x | x | x | x | x | x |
3.3.0 | 6.8.9-1 Q16 | 6.8.9-1 Q16 | 6.9.1-2 Q16 | 6.9.1-2 Q16 | x | x | x | x | x | x |
3.4.0 | x | 6.8.9-1 Q16 | 6.9.1-2 Q16 | 6.9.1-2 Q16 | 6.9.2-0 Q16 | x | x | x | x | x |
3.4.1 | x | 6.8.9-1 Q16 | 6.9.3-7 Q16 | 6.9.3-7 Q16 | 6.9.3-7 Q16 | x | x | x | x | x |
3.4.2 | x | 6.8.9-1 Q16 | 6.9.3-7 Q16 | 6.9.3-7 Q16 | 6.9.3-7 Q16 | x | x | x | x | x |
3.4.3 | x | x | 6.9.3-7 Q16 | 6.9.3-7 Q16 | 6.9.3-7 Q16 | 6.9.3-7 Q16 | x | x | x | x |
3.4.4 | x | x | x | x | x | 6.9.3-7 Q16 | 7.0.7-11 Q16 | 7.0.7-11 Q16 | 7.0.7-11 Q16 | x |
3.5.0 | x | x | x | x | x | x | x | 7.0.7-11 Q16 | 7.0.7-11 Q16 | 7.0.7-11 Q16 |
3.5.1 | x | x | x | x | x | x | x | 7.0.7-11 Q16 | 7.0.7-11 Q16 | 7.0.7-11 Q16 |
3.6.0rc1 | x | x | x | x | x | x | x | 7.1.0-13 Q16 | 7.1.0-13 Q16 | 7.1.0-13 Q16 |
So, in order to install the correct ImageMagick version, we need to know the version of PHP and the version of imagick.
At the moment, Install-PhpExtensionPrerequisite
(and Install-ImagickPrerequisite
) is only aware of the PHP version, so this is a problem.
We have 2 options:
- get rid of the
Install-ImagickPrerequisite
function
I noticed that thephp_imagick-....zip
files available at https://windows.php.net/downloads/pecl now come with the required ImageMagick DLLs (IIRC it was not so a few years ago), so we don't have to download another file with the ImageMagick dependencies - add a new (required) argument to
Install-PhpExtensionPrerequisite
andInstall-ImagickPrerequisite
with the imagick version
In order to know it we'd need to callGet-PhpExtension
:$extensionVersion = (Get-PhpExtension -Path Path\To\php_imagick.dll).Version
There will be a change required in setup-php in both cases, so option 1 seems better, but whatever is easier for you.
so option 1 seems better
Here it is: #95.
I'm going to publish a new release with this fix as soon as your code is ready.
@shivammathur just drop me a note when you are ready
@mlocati Please go ahead with the release.
@shivammathur Done
Awesome! Thanks for fixing this quickly.