Imagick 7.X in PHP 8.3

Hello,

I can install the PHP extension Imagick 6.X via the panel.

I have tried many ways, but I have not found a working way that would allow me to enjoy Imagick 7.X with PHP 8.3.

I have removed, installed using PECL, IMEI, added the extension to php.ini, but I still have not been able to install Imagick 7.X correctly. Does anyone have any ideas?

[SOLVED] [Edited: 31.08.2024]

Step 1: Remove Imagick completely:

sudo apt-get remove --purge imagemagick imagemagick-* && sudo apt-get autoremove && sudo apt-get clean

Step 2: Install the latest version of Imagick using IMEI:

t=$(mktemp) && \
wget 'https://dist.1-2.dev/imei.sh' -qO "$t" && \
bash "$t" && \
rm "$t"

Step 3: Install PHP Imagick extension using PECL:

cd /tmp
wget https://pecl.php.net/get/imagick-3.7.0.tgz
tar -zxvf imagick-3.7.0.tgz
cd /tmp/imagick-3.7.0
sudo /usr/local/lsws/lsphp82/bin/phpize
./configure --with-imagick=/usr/local/lsws/lsphp83 --with-php-config=/usr/local/lsws/lsphp83/bin/php-config
make
make install
echo "extension=imagick.so" >> /usr/local/lsws/lsphp83/etc/php/8.3/mods-available/40-imagick.ini
cp modules/imagick.so /usr/local/lsws/lsphp83/lib/php/20230831/

If you get the error: shtool at ‘/tmp/imagick-3.7.0/build/shtool’ does not exist or is not executable.
Make sure that the file exists and is executable and then rerun this script.

Try:

git clone https://github.com/Imagick/imagick.git
cd imagick
sudo /usr/local/lsws/lsphp83/bin/phpize
./configure --with-imagick=/usr/local/lsws/lsphp83 --with-php-config=/usr/local/lsws/lsphp83/bin/php-config
make
make install

touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt
systemctl restart lsws

Step 4: Restart LSWS and PHP:

service lsws restart
killall lsphp