imagick
imagick copied to clipboard
Install error "Unterminated preprocessor conditions" in php 8.3
The first if condition in Imagick.stub.php
is not closed
https://github.com/Imagick/imagick/blob/28f27044e435a2b203e32675e942eb8de620ee58/Imagick.stub.php#L5-L8
This causes a installation error "Unterminated preprocessor conditions" in PHP 8.3
I'll submit a PR
Just had the same issue happening. Here are steps to reproduce:
docker run -it --rm php:8.3-alpine sh
apk update
apk add imagemagick imagemagick-dev gcc make autoconf g++
pecl install imagick
Any solution?
@UtkuDalmaz People have tried to get in touch with the maintainer over different communication channels to no avail. I'm sticking with PHP 8.2 for now. Have a look at the discussion here: https://github.com/Imagick/imagick/pull/641
Thanks. It should be fixed now in develop, but as it never seemed to be a problem on my machine, I can't guarantee that.
I've actually just removed the #if MagickLibVersion > 0x628
as the minimum version of ImageMagick is above that now.
I'll close this issue when I'm more confident it's fixed (aka github actions are passing), but that will require more poking and possibly dropping support for PHP < 7.0 as the gen_stubs.php tool seems to no longer support those. Probably appropriately.
@Danack so happy to hear from you! I hope things are okay.
The issue is easily reproducible with a docker container:
docker run -it --rm php:8.3-alpine sh
apk update
apk add imagemagick imagemagick-dev gcc make autoconf g++
pecl install imagick
@UtkuDalmaz People have tried to get in touch with the maintainer over different communication channels to no avail. I'm sticking with PHP 8.2 for now. Have a look at the discussion here: #641
Yes using php8.2 seems like the best solution for now. I tried it on version 8.2, there was no problem with the installation.
any update on when this issue will be fixed? Thanks!
having the same issue in PHP 8.3 (running on M1/arm and Docker)
Not have updates? I've been waiting for the PECL update with the correction for more than 3 months but so far nothing.
Same issue here
A small recap: the issue is fixed on develop
but a new tag for this hasn't been published yet. The maintainers are aware of this. Meanwhile, it means your choices are:
- use
develop
instead of a tagged version - keep using PHP 8.2
- fork the extension and tag a release of your own
You can also subscribe to this issue notifications, someone will very likely announce it here when a new tag appears.
But it's not very useful to post comment to "+1" the issue, complain or ask for estimates on when this will happen
It's a simple comment, no harm done 😘 Thanks for the recap tho, thought something might've happened since the last official info was about two month ago.
Sometimes it works, sometimes it doesn't strange bug
I tried this way
RUN pecl install imagick
RUN docker-php-ext-enable imagick
For everybody who is using mlocati/php-extension-installer
RUN install-php-extensions imagick/imagick@master
nevertheless: it's only a workarround in my opinion. It's now more than two months ago that I had a last look on this issue and in all projects where I used imagick I finally could switch to gd or gmagick without any problems when upgrading to PHP8.3... Until today - now I have a project where I have to stick with imagick and I just see: still the same issue...
I know - the solution above works. But sorry... for productive environments I don't see an untagged version as a stable solution - in a production environment I need deterministic build processes and installation behavior and for that it is indispensable to have a tagged version of all dependencies... Just for a shortime workaround, I would accept such a develop solution.
If this extension cannot ensure this any more, I guess it's really EOL because more and more people will switch. That's why I again suggest to share responsibility for such an important php extension. It's also an option to contact the php foundation to request about helping in maintaining. Maybe the interest is high enough in case of this extension.
On the other side: Where is the problem to just put a tag on it?
Thanks to everybody who is working on it.
bumping for visibility. I am waiting for imagick to upgrade my websites to php 8.3. Hope this gets resolved soon 🙏
WHM OS AlmaLinux v8.9.0
bumping because I don't know how to follow, stuck on 8.2
Can we expect a new release on PECL in the near future with a fix for this? If so, can we get an estimated time frame for it? (i.e. 1 month, 3 months, etc)
This is so silly... this major issue has been around for 6 months now and nobody's managed to fix it and push it to official PECL release yet?
Thanks. It should be fixed now in develop, but as it never seemed to be a problem on my machine, I can't guarantee that.
I've actually just removed the
#if MagickLibVersion > 0x628
as the minimum version of ImageMagick is above that now.I'll close this issue when I'm more confident it's fixed (aka github actions are passing), but that will require more poking and possibly dropping support for PHP < 7.0 as the gen_stubs.php tool seems to no longer support those. Probably appropriately.
Hi @Danack
Could we fast forward this to solve the issue which seems to block many ppl right now. A fetch of the master should not be a solution i think..
Is there anything some of us could do / help here to fast forward close this issue?
🙏🏻
Looks like we need a reminder :)
So, the issue is fixed on develop but there are no tagged releases with the fix
you can:
- use develop
- use a specific commit
- keep using PHP 8.2
- fork the extension and tag a release of your own
- use another tool
- donate using the "Sponsor" below (or better: get your company to sponsor their work) and wait :crossed_fingers:
- wait :crossed_fingers:
and this one is a should:
- stop complaining and asking for estimates
The maintainers are already aware. They have their reasons for not moving forwards and it's up to them to decide to communicate them or not. They don't owe us anything.
Looks like we need a reminder :)
So, the issue is fixed on develop but there are no tagged releases with the fix
you can:
- use develop
- use a specific commit
- keep using PHP 8.2
- fork the extension and tag a release of your own
- use another tool
- donate using the "Sponsor" below (or better: get your company to sponsor their work) and wait 🤞
- wait 🤞
and this one is a should:
- stop complaining and asking for estimates
The maintainers are already aware. They have their reasons for not moving forwards and it's up to them to decide to communicate them or not. They don't owe us anything.
pathetic your reply, sorry!
Looks like we need a reminder :)
So, the issue is fixed on develop but there are no tagged releases with the fix
you can:
- use develop
- use a specific commit
- keep using PHP 8.2
- fork the extension and tag a release of your own
- use another tool
- donate using the "Sponsor" below (or better: get your company to sponsor their work) and wait 🤞
- wait 🤞
and this one is a should:
- stop complaining and asking for estimates
The maintainers are already aware. They have their reasons for not moving forwards and it's up to them to decide to communicate them or not. They don't owe us anything.
The problem is that most of the time you cannot choose a tool. If it is a dependency of other open source things, there is nothing you can do.
Unfortunately we have no recent updates, so we can only wait.
I understand the developers and I'm not asking for anything, I can even maintain it locally.
But really, this seems to be a dead project at the moment, no company would be motivated to invest if there is no communication.
It is just a sad fact. I'm still grateful and hope for good things for everyone.
I know one day it will be tagged, but people, stop insulting each other here, this is not a chatroom.
Man I just tried to install 8.3 + Imagick on my WHM/Cpanel (CL8) Server and ran into this brick wall at full speed :(
Was planning on skipping 8.2 completely, now I guess I'm going to have to go to 8.2 for now, then upgrade again later.
Alternatively, I really don't mind using the develop
branch, but I am unsure how to do this from a WHM / EasyApache / YUM based system.
Does anyone know how I can install this using the develop branch in this type of environment?
Man I just tried to install 8.3 + Imagick on my WHM/Cpanel (CL8) Server and ran into this brick wall at full speed :(
Was planning on skipping 8.2 completely, now I guess I'm going to have to go to 8.2 for now, then upgrade again later.
Alternatively, I really don't mind using the
develop
branch, but I am unsure how to do this from a WHM / EasyApache / YUM based system.Does anyone know how I can install this using the develop branch in this type of environment?
https://github.com/Imagick/imagick/pull/641 here people gave some instructions.
You can do it with pecl providing a local tar
@FedericoHeichou Thanks! I was able to get it working!
I loosely followed these instructions:
pecl download imagick
tar xzf imagick-3.7.0.tgz
patch mypatch.diff imagick/Imagick.stub.php
# get md5 of that patched file and sed it in package.xml
tar czf imagick-3.7.0-patch01.tgz imagick package.xml
pecl install ./imagick-3.7.0-patch01.tgz
and it worked :)
in docker builds we use next command to setup extension:
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libmagickwand-dev \
&& mkdir -p /usr/src/php/ext/imagick \
&& curl -fsSL https://github.com/Imagick/imagick/archive/944b67fce68bcb5835999a149f917670555b6fcb.tar.gz | tar xvz -C "/usr/src/php/ext/imagick" --strip 1 \
&& docker-php-ext-install imagick \
&& apt-get remove -y \
libmagickwand-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/pear
where 944b67fce68bcb5835999a149f917670555b6fcb
is commit after fix, or it can be replaced by any reference in the repository, but its better to do not use latest version to avoid unexpected builds
We had the problem of installing Imagick for php 8.3 via PECL in cPanel and found the following to work with no issues:
cd /usr/src
wget https://codeload.github.com/Imagick/imagick/zip/refs/heads/master
unzip master
rm -rf master
mv imagick-master imagick
cd imagick
/opt/cpanel/ea-php83/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php83/root/usr/bin/php-config
make
make test
make install
echo "extension=imagick.so" >> /opt/cpanel/ea-php83/root/etc/php.d/imagick.ini
systemctl restart httpd
cd ..
rm -rf imagick
I just tried installing via WHM PECL installer today and it worked ! Maybe they finally fixed it on remote
It's not fixed. You could easily reproduce with a docker container.
docker run -it --rm php:8.3-alpine sh
apk update
apk add imagemagick imagemagick-dev gcc make autoconf g++
pecl install imagick
Has anyone succeeded in installing the imagick-php
extension with the manual installation method?
I'm grateful for the suggestions that were suggested earlier, thanks to these I've been able to add Imagick to my Alpine image, however it seems the PDF documents cannot be processed (even though GS is installed).
Has anyone encountered the same issue with these alternative installation methods?
RUN set -eux; \
apk add --no-cache imagemagick-dev ghostscript; \
curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \
echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \
tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \
grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \
test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \
sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \
grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \
docker-php-ext-install /tmp/imagick-3.7.0; \
rm -rf imagick.tgz /tmp/imagick-3.7.0