help compiling lsphp81-imagick with ImageMagick version 7

#1
currently on a fresh server install with openlitespeed for wordpress Azure image. i cant figure out how to update ImageMagick to the latest version 7 because lsphp81-imagick 3.7.0 is compiled from ImageMagick 6.9.
 
#2
this was my attempted bash code but it still compiles from ImageMagick6.9 and im not sure why.

apt update
apt install build-essential
apt install pkg-config
apt install imagemagick libmagickwand-dev
apt install lsphp81-dev

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

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

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

Cold-Egg

Administrator
#3
Hi @williamskea,
I saw you have posted similar questions in many places, so I will just reply here once.
The current system's default version is v6.9, to get v7.0 with the Imagick package, you will need to compile it.

Code:
wget https://download.imagemagick.org/ImageMagick/download/ImageMagick.tar.gz
tar -zxvf ImageMagick.tar.gz
cd ImageMagick-7.1.1-27/
./configure
make
make install
ldconfig /usr/local/lib
Code:
wget https://pecl.php.net/get/imagick-3.7.0.tgz
tar -zxvf imagick-3.7.0.tgz
sudo /usr/local/lsws/lsphp82/bin/phpize
./configure --with-imagick=/usr/local/lsws/lsphp82 --with-php-config=/usr/local/lsws/lsphp82/bin/php-config
make
make install

echo "extension=imagick.so" >> /usr/local/lsws/lsphp82/etc/php/8.2/mods-available/40-imagick.ini
cp modules/imagick.so /usr/local/lsws/lsphp82/lib/php/20220829/

service lsws restart
killall lsphp
The version number might be different than yours, please substitute it with yours.
 

Attachments

#4
legend, thanks. ill try it on a dev vm server tonight. i couldnt figure out how to delete the other post on the forum, sorry. ill try to remove reddit.
 
#6
Thanks, that worked. I just changed two things.
1. Extracting tar files in /tmp.
2. My lsphp module code was different, found using filezilla. (20210902)
3. Used php81 instead 82.

So this was my whole code that worked:. Thanks again!


cd /tmp
wget https://download.imagemagick.org/ImageMagick/download/ImageMagick.tar.gz
tar -zxvf ImageMagick.tar.gz
cd /tmp/ImageMagick-7.1.1-27/
./configure
make
make install
ldconfig /usr/local/lib

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/lsphp81/bin/phpize
./configure --with-imagick=/usr/local/lsws/lsphp81 --with-php-config=/usr/local/lsws/lsphp81/bin/php-config
make
make install
echo "extension=imagick.so" >> /usr/local/lsws/lsphp81/etc/php/8.1/mods-available/40-imagick.ini
cp modules/imagick.so /usr/local/lsws/lsphp81/lib/php/20210902/
service lsws restart
killall lsphp
 
Top