Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kejilion opened this issue Nov 22, 2024 · 26 comments
Open

Comments

@kejilion
Copy link


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
Copy link

yendyr commented Nov 22, 2024

same problem here

@kejilion
Copy link
Author

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

docker exec php install-php-extensions 65e27f2bc0

@picov
Copy link

picov commented Nov 22, 2024

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
Copy link

nephaste commented Nov 22, 2024

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
Copy link
Author

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

@pennedav
Copy link

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
Copy link

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
Copy link

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
Copy link

usarise commented Nov 25, 2024

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
Copy link

picov commented Nov 25, 2024

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
Copy link

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
Copy link

picov commented Nov 25, 2024

@BowFarmer
It looks like there are compatibility issues however.

@BowFarmer
Copy link

BowFarmer commented Nov 25, 2024

I'm not working on this project but as usarise pointed out earlier, there is a fix that is being worked on:
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
Copy link

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 #640)

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

@usarise
Copy link

usarise commented Nov 25, 2024

@usarise
Copy link

usarise commented Nov 25, 2024

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
Copy link

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
Copy link

usarise commented Nov 25, 2024

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

@usarise
Copy link

usarise commented Nov 25, 2024

@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
Copy link

tianon commented Nov 25, 2024

I think this is a duplicate of #689

@GeLoLabs
Copy link

GeLoLabs commented Dec 1, 2024

For those who want something working, here my Dockerfile:

# Imagick
ARG IMAGICK_VERSION=3.7.0
RUN set -eux \
    && apk add --no-cache \
      imagemagick \
      jpegoptim \
      libwebp \
      libwebp-tools \
    && apk add --no-cache --virtual .imagick-deps \
      $PHPIZE_DEPS \
      imagemagick-dev \
      libjpeg-turbo-dev \
      libpng-dev \
      libwebp-dev \
#    && pecl install imagick-"$IMAGICK_VERSION" \
#    && docker-php-ext-enable imagick \
#    && apk del .imagick-deps
    && curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/tags/${IMAGICK_VERSION}.tar.gz \
    && tar --strip-components=1 -xf /tmp/imagick.tar.gz \
    && sed -i 's/php_strtolower/zend_str_tolower/g' imagick.c \
    && phpize \
    && ./configure \
    && make \
    && make install \
    && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \
    && rm -rf /tmp/* \
    && apk del .imagick-deps

@jamesfreeman959
Copy link

Thanks for this - can confirm it works for be building on the php:8.3.14-fpm container image.

@cyformatician
Copy link

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.

Many thanks for sharing the workaround ... this was it but instead of commenting the line out, I replaced php_strtolower with zend_str_tolower.

Cheers!

@BowFarmer
Copy link

Thanks.

@joeworkman
Copy link

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.

Many thanks for sharing the workaround ... this was it but instead of commenting the line out, I replaced php_strtolower with zend_str_tolower.

Cheers!

This is exactly what I did, and it just worked for me. I am running this on an Intel Mac via homebrew.

@PaulCombal
Copy link

PaulCombal commented Dec 7, 2024

I'm suddenly hit with something that doesn't look like a PHP version error:

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

The deployment somehow still succeeded so I'm at a loss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests