Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- while read vc
- do
- rm -f /root/webp.php
- echo '<?php $ar=gd_info(); foreach($ar as $k=>$v){ if(strpos($k,"WebP")!==false) { if($v==1) echo "OK"; else echo "KO"; }}?>' > /root/webp.php
- minv="6"
- configmin="73"
- complete=$(echo $vc | cut -d"|" -f1;)
- short=$(echo $vc | cut -d"|" -f2;)
- vshort=$(echo $short | cut -d"." -f1;)
- vshort2=$(echo $short | cut -d"." -f2;)
- #Check if it's php7.X
- if [ "$vshort" -gt "$minv" ]
- then
- #Test if webp is yet running with this version
- test=$(/opt/plesk/php/$short/bin/php /root/webp.php);
- if [ "$test" = "KO" ]
- then
- cd /root/
- rm -f /root/mirror
- yum -y install make gcc plesk-php$vshort$vshort2-devel libjpeg-turbo-devel libpng-devel libXpm-devel freetype-devel libwebp-devel
- wget http://be2.php.net/get/php-$complete.tar.gz/from/this/mirror --no-check-certificate
- tar -xzf mirror
- cd /root/php-$complete/ext/gd
- /opt/plesk/php/$short/bin/phpize
- #Check if it's php 7.4 and change configure line in this case
- if [ "$vshort$vshort2" -gt "$configmin" ]
- then
- ./configure --with-php-config=/opt/plesk/php/$short/bin/php-config --with-webp --with-freetype --with-jpeg --with-xpm
- else
- ./configure --with-php-config=/opt/plesk/php/$short/bin/php-config --with-webp-dir=/usr/include/webp --with-freetype-dir=/usr/include/freetype2/freetype --with-jpeg-dir=/usr/include --with-xpm-dir=/usr/include
- fi
- make
- mv /opt/plesk/php/$short/lib64/php/modules/gd.so /opt/plesk/php/$short/lib64/php/modules/gd.so_orig
- cp modules/gd.so /opt/plesk/php/$short/lib64/php/modules/
- plesk bin php_handler --reread
- #rpm -e --justdb plesk-php$short-gd
- rm -f /root/mirror
- rm -rf /root/php-$complete
- fi
- fi
- done < <(plesk bin php_handler --list 2>/dev/null | grep enabled | sed "s/ by OS vendor//g"| sed "s/ */ /g"| cut -f3,5 -d" "| sed "s/ /\\|/g")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement