Imagick / imagick

🌈 The Imagick PHP extension 🌈
http://pecl.php.net/imagick
Other
550 stars 144 forks source link

When will the imagick extension support php8.4? Now it will report an error #698

Open kejilion opened 1 week ago

kejilion commented 1 week ago

Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20240924/imagick.so (Error relocating /usr/local/lib/php/extensions/no-debug-non-zts-20240924/imagick.so: php_strtolower: symbol not found), /usr/local/lib/php/extensions/no-debug-non-zts-20240924/imagick.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20240924/imagick.so.so: No such file or directory)) in Unknown on line 0

How do I solve this problem? Thank you

yendyr commented 1 week ago

same problem here

kejilion commented 1 week ago

I'm trying to install it like this, I don't know if it works

docker exec php install-php-extensions Imagick/imagick@65e27f2bc0

picov commented 1 week ago

PHP 8.4.1 with ImageMagick-7.1.1-41

pecl install imagick

.... In /tmp/pear/install/imagick/Imagick.stub.php: Imagick::newImage(): Parameter format has null default, but is not nullable make: *** [Makefile:191: /tmp/pear/install/imagick/Imagick_arginfo.h] Error 1 ERROR: `make INSTALL_ROOT="/tmp/pear/install/pear-build-rootti7iddt3pa35cOi0VJK/install-imagick-3.7.0" install' failed

nephaste commented 1 week ago

same issue with PECL install seems better building from source... works on aarch64, but my x86_64 version has issue (weird)

edit : finally worked problem was between keybard and chair... using a phpize from source and ./configure in my prefix all runs

kejilion commented 6 days ago

I have successfully installed imagick in the docker php:fpm-alpine build I used

pennedav commented 6 days ago

Running into an issue while building using the Debian (Bookworm) PHP 8.4 Apache image.

Partial Dockerfile:

FROM php:8.4-apache-bookworm
...
RUN pecl install imagick-3.7.0 \
    && docker-php-ext-enable imagick
...

Selected output:

18.17 In /tmp/pear/temp/imagick/Imagick.stub.php:
18.17 Imagick::newImage(): Parameter format has null default, but is not nullable
18.18 make: *** [Makefile:191: /tmp/pear/temp/imagick/Imagick_arginfo.h] Error 1
18.19 ERROR: `make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuserogvs7jscec7c7Cd3ecS/install-imagick-3.7.0" install' failed
------
Dockerfile:27
--------------------
  26 |
  27 | >>> RUN pecl install imagick-3.7.0 \
  28 | >>>     && docker-php-ext-enable imagick
  29 |
--------------------
ERROR: failed to solve: process "/bin/sh -c pecl install imagick-3.7.0     && docker-php-ext-enable imagick" did not complete successfully: exit code: 1
BowFarmer commented 4 days ago

When I try to install it on php 8.4 with pecl, I get this: /imagick-3.7.0/imagick.c:606:7: error: call to undeclared function 'php_strtolower'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

BowFarmer commented 4 days ago

I did manage to work around the 'php_strtolower' issue with php 8.4. I install imagick with pecl, and during the installation the process stops to confirm the prefix for the installation:

Please provide the prefix of ImageMagick installation [autodetect] :

Before hitting enter I edit imagick.c which at that point in my case is in:

/private/tmp/pear/temp/imagick/imagick.c

And I comment out line 606 with the 'php_strtolower' call which no longer seems to work in php 8.4. //php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); After that I let pecl finish the installation and it has no problems compiling and installing imagick. And I have imagick working with php 8.4 and it works fine with WordPress. Not sure what the implications are of not having that string not being converted to lowercase, but I haven't run into issues yet. I'm primarily using imagick for a WordPress development site and am testing the ramifications of using php 8.4.

usarise commented 4 days ago

And I comment out line 606 with the 'php_strtolower' call which no longer seems to work in php 8.4. //php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));

It is better to make changes from this branch

picov commented 4 days ago

But then real question is: does this project is still active ? Latest official release is v3.7.0 released on 2022-01-11 ! Latest commit is on Mar 18, 2023 !

BowFarmer commented 4 days ago

Imagick is primarily a wrapper that allows PHP to interface with ImageMagick, where all the actual image manipulation happens. Unlike ImageMagick, which needs to evolve to keep up with new formats, improvements, and image processing capabilities, Imagick's role is simpler—it's about maintaining compatibility and providing PHP bindings. Therefore, it doesn't necessarily need frequent changes unless compatibility issues arise, as with new PHP versions or changes in ImageMagick's API.

picov commented 4 days ago

@BowFarmer It looks like there are compatibility issues however.

BowFarmer commented 4 days ago

I'm not working on this project but as usarise pointed out earlier, there is a fix that is being worked on: https://github.com/Imagick/imagick/commit/65e27f2bc0 You can see three instances in that fix where php_strtolower has been changed to zend_str_tolower for PHP 8.4 compatibility.

jderusse commented 4 days ago

actually, I feel the project is not maintain anymore. There is another issue with pho 8.3 that is fixed in master but no released (see this issue for example https://github.com/Imagick/imagick/issues/640)

I believe, someone should fork it, a d make it the new default.

usarise commented 4 days ago

Docker users don't feel the full impact of stagnation as much. https://github.com/mlocati/docker-php-extension-installer uses the https://github.com/mvorisek/imagick or https://github.com/mvorisek/imagick/tree/fix_php84 branch, which contains all actual fixes.

usarise commented 4 days ago

Latest commit is on Mar 18, 2023 !

@picov In reality latest commit is on Jul 7, 2024. Relevant branch here is actually -> https://github.com/Imagick/imagick/tree/develop

BowFarmer commented 4 days ago

So for those of using pecl, and installing imagick as pecl install imagick, is there a timeline when those changes for php 8.4 will be in the main branch?

usarise commented 4 days ago

@BowFarmer Of course not. It doesn't even include all the fixes for PHP 8.3 yet.

usarise commented 4 days ago

@BowFarmer Latest released for pecl 2022-01-11, a month after the release of 8.1.1 Since then, 3 new versions of the PHP have been released, but pecl is still not updated.

tianon commented 4 days ago

I think this is a duplicate of #689