Imagick / imagick

šŸŒˆ The Imagick PHP extension šŸŒˆ
http://pecl.php.net/imagick
Other
548 stars 138 forks source link

imagick fails in PHP 7.2; php.ini problem? #224

Closed tmb-github closed 5 years ago

tmb-github commented 6 years ago

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:

[23-Dec-2017 15:55:49 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

Using the older form of the extension initialization, (extension=php_imagick.dll), the error message becomes:

[23-Dec-2017 15:55:49 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: C:\xampp\php\ext\php_imagick.dll (The specified module could not be found. ), C:\xampp\php\ext\php_php_imagick.dll.dll (The specified procedure could not be found. )) in Unknown on line 0

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).

weltling commented 5 years ago

Thanks for the ping. The snapshot is now running, please check same location in a couple of hours.

@mlocati it's triggered manually. Whenever you need some, please ping :)

Thanks.

mlocati commented 5 years ago

@weltling I'm wondering why there's a snapshot build for PHP 7.2, but release builds for PHP 7.1-...

weltling commented 5 years ago

@mlocati AFAIR that one was done specifically to cover a PR with 7.2 related fixes. In general, arbittary snapshots are triggered manually. Except, when a new PHP version is in pre cycle, usually regular PECL releases are built also against some pre PHP version. For automatic builds it's essential something to be release on PECL, as the build bot only fetches tarballs from there.

Thanks.

mlocati commented 5 years ago

@mlocati very useful. Will you be updating for PHP 7.3 now out as stable?

@garyrowswell I updated https://mlocati.github.io/articles/php-windows-imagick.html so that it now includes PHP 7.3

PhpManager should be able to install imagick by using the snapshot flag:

Install-PhpExtension -Extension imagick -MinimumStability snapshot -Path C:\Path\To\PHP7.3
garyrowswell commented 5 years ago

@mlocati Excellent. The ImageMagick website lists 7.0.8-16 as latest release would that install the files necessary for the imagick php extension or can the pecl dep for imagemagick be updated to latest version as well?

mlocati commented 5 years ago

I absolutely don't know... just try it :wink:

garyrowswell commented 5 years ago

@mlocati Using the latest from imagemagick.org does work, but php issues a warning. @weltling is there any chance the imagick extension can be recompiled for this latest imagemagick version? (if that's the right thing to ask)

Imagick was compiled against ImageMagick version 1799 but version 1800 is loaded. Imagick will run but may behave surprisingly

chfabbro commented 5 years ago

@garyrowswell I see new snapshot builds posted yesterday: https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/

Perhaps one of these was compiled for the new version?

weltling commented 5 years ago

@garyrowswell no plans for dependency upgrades in the near future, at least this year. Could be reconsidered, if there are some hard weight issues with the current version.

Thanks.

AnrDaemon commented 5 years ago

Can somebody please push a button to release compiled Windows binaries on PECL website proper?

Jan-E commented 5 years ago

@weltling The 7.2 & 7.3 versions at https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/ aren't linked at https://pecl.php.net/package/imagick/3.4.3/windows Can you copy them to https://windows.php.net/downloads/pecl/releases/imagick/3.4.3/ ?

mialdi98 commented 5 years ago

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):

  • ImageMagick-7.0.7-11-vc15-x64.zip
  • php_imagick-3.4.3-7.2-ts-vc15-x64.zip

The workflow seems really clunky to me, but I did exactly as instructed:

  • Extract from php_imagick-ā€¦.zip to the ext directory the php_imagick.dll file of your PHP installation
  • Extract from ImageMagick-ā€¦.zip to the root PHP directory (where php.exe resides) the DLL files that start with (and there are a TON): CORE_RL_ IM_MOD_RL_
  • Add this line to your php.ini file 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 šŸ˜ø

works for 7.1 fine too! (win10 x32(x86) php 7.1 XAMPP 3.2.2) but with small add u need to add this bunch of dlls in Apache\bin too.

jerry-cbn commented 5 years ago

into the PHP root directory (where you have php.exe), or to a directory in your PATH variable

Be careful !! The PHP root directory MUST BE known in the PATH variable. And it's not necessarily the case (it wasn't for me, I using WAMP). After added my PHP root directory to my PATH variable, it works like a charm.

AnrDaemon commented 5 years ago

The PHP root directory MUST BE known in the PATH variable.

That's absolutely not true. Enough that you have a proper association to run *.php files.

schmidtl4 commented 5 years ago

@mlocati - Awesome PHPManager power shell module. Fixed my imagick installation challenges and will be my goto module for managing PHP installation. Beautiful! Thanks.

Danack commented 5 years ago

I'm going to close this issue as I don't think there's anything that needs to be done within this repo to resolve any problems people are having.

If anyone wants to step up and be the 'official windows Imagick maintainer' to deal with this sort of thing, that would be awesome.

patieru12 commented 5 years ago

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

Works Fine for me great thanks

steinhaug commented 5 years ago

Same problem here, but reading all the comments here I found the sollution thankfully!

The missing information is that the CORERL and IM_MODRL files should NOT BE COPIED INTO EXTENSIONS DIRECTORY, however into your main PHP directory. So in my case where php is installed at c:\php the steps would be:

  1. copy "php_imagick.dll" into c:\php\ext
  2. add "extension=imagick" into php.ini
  3. copy "CORERL*" into c:\php
  4. copy "FILTER_*" into c:\php
  5. copy "IM_MODRL*" into c:\php

Restart Apache and done!

mlocati commented 5 years ago

@steinhaug those instruction are already available at the page I linked above, that is https://mlocati.github.io/articles/php-windows-imagick.html

imomer commented 3 years ago

How to install it on Windows 10 x64, Apache2.4, PHP v7.4. I have tried all the above methods. Not a single one worked for me šŸ˜¢ image

mlocati commented 3 years ago

@imomer you can use https://mlocati.github.io/articles/php-windows-imagick.html or https://github.com/mlocati/powershell-phpmanager

imomer commented 3 years ago

@imomer you can use https://mlocati.github.io/articles/php-windows-imagick.html or https://github.com/mlocati/powershell-phpmanager

šŸ‘‰ https://mlocati.github.io/articles/php-windows-imagick.html Worked for me... Thanks Mate šŸ‘

tmb-github commented 3 years ago

Has anyone worked out how to compile an imagick extension for PHP 8? I need it for my lives sites as well as my Windows-based localhost.

Jan-E commented 3 years ago

Inside the zips at https://www.apachelounge.com/viewtopic.php?t=6359 With the dependent DLL's here: https://ci.appveyor.com/project/Jan-E/imagemagick-windows/builds/36477084/job/qk4mql7svrxsjor7/artifacts (x64) https://ci.appveyor.com/project/Jan-E/imagemagick-windows/builds/36477084/job/8vmap42odmfqp713/artifacts (x86)

dekker-m commented 3 years ago

What fixed the issue for me was to install the Visual C++ Redistributable for Visual Studio 2015 package. I think I have been struggeling with the same issue multiple times in the past (and I think I might not be the only one).

Allexim commented 8 months ago

imagick must be loaded before gd! 10-imagick.ini 20-gd.ini

MaferNovastratics16 commented 3 months ago

Same problem here, but reading all the comments here I found the sollution thankfully!

The missing information is that the CORERL and IM_MODRL files should NOT BE COPIED INTO EXTENSIONS DIRECTORY, however into your main PHP directory. So in my case where php is installed at c:\php the steps would be:

  1. copy "php_imagick.dll" into c:\php\ext
  2. add "extension=imagick" into php.ini
  3. copy "CORERL*" into c:\php
  4. copy "FILTER_*" into c:\php
  5. copy "IM_MODRL*" into c:\php

Restart Apache and done! @steinhaug This work for me!! Thank you very much, I just spent two hours making work Imagick