[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