Install php-imagick on NextcloudPi with PHP8.1

Nextcloud version (eg, 20.0.5): 28.0.3.2
Operating system and version (eg, Ubuntu 20.04): debian 11
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): 8.1

The issue you are facing:

I need HEIC Image Support in my NextcloudPi Instance.
Nextcloud Documentation tells me i need to install php-imagick for that.
Apt get install command tell me the wrong php version (8.3) for imagick.
What can i do to get the correct version and dependencies?

~ $ sudo apt-get install php-imagick
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  fonts-droid-fallback fonts-noto-mono fonts-urw-base35 ghostscript gsfonts imagemagick-6-common libfftw3-double3 libgs9
  libgs9-common libidn11 libijs-0.35 libjbig2dec0 liblqr-1-0 libltdl7 libmagickcore-6.q16-6 libmagickwand-6.q16-6
  libopenjp2-7 libpaper-utils libpaper1 php8.3-cli **php8.3**-common php8.3-imagick **php8.3**-opcache php8.3-phpdbg php8.3-readline
  poppler-data
Suggested packages:
  fonts-noto fonts-freefont-otf | fonts-freefont-ttf fonts-texgyre ghostscript-x libfftw3-bin libfftw3-dev
  libmagickcore-6.q16-6-extra php-pear poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic
  | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum
The following NEW packages will be installed:
  fonts-droid-fallback fonts-noto-mono fonts-urw-base35 ghostscript gsfonts imagemagick-6-common libfftw3-double3 libgs9
  libgs9-common libidn11 libijs-0.35 libjbig2dec0 liblqr-1-0 libltdl7 libmagickcore-6.q16-6 libmagickwand-6.q16-6
  libopenjp2-7 libpaper-utils libpaper1 php-imagick php8.3-cli php8.3-common php8.3-imagick **php8.3**-opcache php8.3-phpdbg
  php8.3-readline poppler-data
0 upgraded, 27 newly installed, 0 to remove and 61 not upgraded.
Need to get 4,371 kB/24.1 MB of archives.
After this operation, 91.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. install NCP 1.53.2
  2. install imagick (sudo apt-get install php-imagick)

Hey there,
I am facing a similar issue!

My Setup:

Hardware: Raspberry Pi 4
OS: Linux 5.15.0-1059-raspi #62-Ubuntu
RAM: 8GB
NC Version: 29.0.4
PHP Version: 8.1-fpm

After the recent update (not sure if its NC or Ubuntu), Php fpm process is failing to start.

After a lot of troubleshooting, I can see that the module (php-imagick) is causing the php crash.

I try to purge php8.1-imagick and reinstall it, but before the process finishes, php-fpm process is killed and goes inactive.

Here is how it looks:

Then it gives me a segmentation fault if i try to do anything with php. even executing “php -v” gives segmentation fault.

I removed everything and re-configured all modules, to find out that this imagick is causing it.

Can anyone please provide a fix for this?
Warning shows up in NC admin panel, and i cannot disable the themes app on NC 29.

I want to fix this error.
Any help is appreciated.

Thanks!